Skip to content

Commit

Permalink
fix: 允许App端uni.setTabBarStyle传入其他选项
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed May 9, 2020
1 parent 29e6866 commit 0c9e689
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions src/platforms/app-plus/service/api/ui/tab-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,19 @@ export function setTabBarItem ({
}
}

export function setTabBarStyle ({
color,
selectedColor,
backgroundColor,
borderStyle
}) {
export function setTabBarStyle (style = {}) {
if (!isTabBarPage()) {
return {
errMsg: 'setTabBarStyle:fail not TabBar page'
}
}
const style = {}
const borderStyles = {
black: 'rgba(0,0,0,0.4)',
white: 'rgba(255,255,255,0.4)'
}
if (color) {
style.color = color
}
if (selectedColor) {
style.selectedColor = selectedColor
}
if (backgroundColor) {
style.backgroundColor = backgroundColor
}
const borderStyle = style.borderStyle
if (borderStyle in borderStyles) {
borderStyle = borderStyles[borderStyle]
}
if (borderStyle) {
style.borderStyle = borderStyle
style.borderStyle = borderStyles[borderStyle]
}
tabBar.setTabBarStyle(style)
return {
Expand Down

0 comments on commit 0c9e689

Please sign in to comment.