提交 0c9e689a 编写于 作者: Q qiang

fix: 允许App端uni.setTabBarStyle传入其他选项

上级 29e68666
...@@ -32,36 +32,19 @@ export function setTabBarItem ({ ...@@ -32,36 +32,19 @@ export function setTabBarItem ({
} }
} }
export function setTabBarStyle ({ export function setTabBarStyle (style = {}) {
color,
selectedColor,
backgroundColor,
borderStyle
}) {
if (!isTabBarPage()) { if (!isTabBarPage()) {
return { return {
errMsg: 'setTabBarStyle:fail not TabBar page' errMsg: 'setTabBarStyle:fail not TabBar page'
} }
} }
const style = {}
const borderStyles = { const borderStyles = {
black: 'rgba(0,0,0,0.4)', black: 'rgba(0,0,0,0.4)',
white: 'rgba(255,255,255,0.4)' white: 'rgba(255,255,255,0.4)'
} }
if (color) { const borderStyle = style.borderStyle
style.color = color
}
if (selectedColor) {
style.selectedColor = selectedColor
}
if (backgroundColor) {
style.backgroundColor = backgroundColor
}
if (borderStyle in borderStyles) { if (borderStyle in borderStyles) {
borderStyle = borderStyles[borderStyle] style.borderStyle = borderStyles[borderStyle]
}
if (borderStyle) {
style.borderStyle = borderStyle
} }
tabBar.setTabBarStyle(style) tabBar.setTabBarStyle(style)
return { return {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册