提交 fd9ba025 编写于 作者: Q qiang

fix: 调整 nvue 页面 uni.setTabBarStyle borderStyle 颜色

上级 023dfe83
...@@ -43,12 +43,27 @@ export function setTabBarStyle ({ ...@@ -43,12 +43,27 @@ export function setTabBarStyle ({
errMsg: 'setTabBarStyle:fail not TabBar page' errMsg: 'setTabBarStyle:fail not TabBar page'
} }
} }
tabBar.setTabBarStyle({ const style = {}
color, const borderStyles = {
selectedColor, black: 'rgba(0,0,0,0.4)',
backgroundColor, white: 'rgba(255,255,255,0.4)'
borderStyle: borderStyle === 'white' ? '#ffffff' : '#c6c6c6' }
}) if (color) {
style.color = color
}
if (selectedColor) {
style.selectedColor = selectedColor
}
if (backgroundColor) {
style.backgroundColor = backgroundColor
}
if (borderStyle in borderStyles) {
borderStyle = borderStyles[borderStyle]
}
if (borderStyle) {
style.borderStyle = borderStyle
}
tabBar.setTabBarStyle(style)
return { return {
errMsg: 'setTabBarStyle:ok' errMsg: 'setTabBarStyle:ok'
} }
......
...@@ -50,17 +50,19 @@ function setTabBarBadge (type, index, text) { ...@@ -50,17 +50,19 @@ function setTabBarBadge (type, index, text) {
* 动态设置 tabBar 某一项的内容 * 动态设置 tabBar 某一项的内容
*/ */
function setTabBarItem (index, text, iconPath, selectedIconPath) { function setTabBarItem (index, text, iconPath, selectedIconPath) {
const item = {} const item = {
index
}
if (text !== undefined) {
item.text = text
}
if (iconPath) { if (iconPath) {
item.iconPath = getRealPath(iconPath) item.iconPath = getRealPath(iconPath)
} }
if (selectedIconPath) { if (selectedIconPath) {
item.selectedIconPath = getRealPath(selectedIconPath) item.selectedIconPath = getRealPath(selectedIconPath)
} }
tabBar && tabBar.setTabBarItem(Object.assign({ tabBar && tabBar.setTabBarItem(item)
index,
text
}, item))
} }
/** /**
* 动态设置 tabBar 的整体样式 * 动态设置 tabBar 的整体样式
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册