Skip to content

Commit

Permalink
fix: 调整 nvue 页面 uni.setTabBarStyle borderStyle 颜色
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Oct 20, 2019
1 parent 023dfe8 commit fd9ba02
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
27 changes: 21 additions & 6 deletions src/platforms/app-plus/service/api/ui/tab-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,27 @@ export function setTabBarStyle ({
errMsg: 'setTabBarStyle:fail not TabBar page'
}
}
tabBar.setTabBarStyle({
color,
selectedColor,
backgroundColor,
borderStyle: borderStyle === 'white' ? '#ffffff' : '#c6c6c6'
})
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
}
if (borderStyle in borderStyles) {
borderStyle = borderStyles[borderStyle]
}
if (borderStyle) {
style.borderStyle = borderStyle
}
tabBar.setTabBarStyle(style)
return {
errMsg: 'setTabBarStyle:ok'
}
Expand Down
12 changes: 7 additions & 5 deletions src/platforms/app-plus/service/framework/tab-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ function setTabBarBadge (type, index, text) {
* 动态设置 tabBar 某一项的内容
*/
function setTabBarItem (index, text, iconPath, selectedIconPath) {
const item = {}
const item = {
index
}
if (text !== undefined) {
item.text = text
}
if (iconPath) {
item.iconPath = getRealPath(iconPath)
}
if (selectedIconPath) {
item.selectedIconPath = getRealPath(selectedIconPath)
}
tabBar && tabBar.setTabBarItem(Object.assign({
index,
text
}, item))
tabBar && tabBar.setTabBarItem(item)
}
/**
* 动态设置 tabBar 的整体样式
Expand Down

0 comments on commit fd9ba02

Please sign in to comment.