提交 3a246cf9 编写于 作者: d-u-a's avatar d-u-a

fix: vue2 web tabbar iconfont selectedColor无效问题,仅更新用户传入的属性

上级 67f076f3
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<div <div
v-if="item.iconfont" v-if="item.iconfont"
:style="{ :style="{
color:selectedIndex === index ? selectedColor : color, color:selectedIndex === index ? item.iconfont.selectedColor : item.iconfont.color,
fontSize: item.iconfont.fontSize || iconWidth fontSize: item.iconfont.fontSize || iconWidth
}" }"
class="uni-tabbar__iconfont" class="uni-tabbar__iconfont"
......
...@@ -8,6 +8,8 @@ const setTabBarStyleProps = ['color', 'selectedColor', 'backgroundColor', 'borde ...@@ -8,6 +8,8 @@ const setTabBarStyleProps = ['color', 'selectedColor', 'backgroundColor', 'borde
const setTabBarBadgeProps = ['badge', 'redDot'] const setTabBarBadgeProps = ['badge', 'redDot']
const setTabBarIconfontStyles = ['text', 'selectedText', 'fontSize', 'color', 'selectedColor']
function setTabBar (type, args = {}) { function setTabBar (type, args = {}) {
const app = getApp() const app = getApp()
...@@ -44,6 +46,10 @@ function setTabBar (type, args = {}) { ...@@ -44,6 +46,10 @@ function setTabBar (type, args = {}) {
app.$children[0].hideTabBar = true app.$children[0].hideTabBar = true
break break
case 'setTabBarItem': { case 'setTabBarItem': {
if (args.iconfont) {
setProperties(tabBar.list[index].iconfont, setTabBarIconfontStyles, args.iconfont)
args.iconfont = tabBar.list[index].iconfont
}
setProperties(tabBar.list[index], setTabBarItemProps, args) setProperties(tabBar.list[index], setTabBarItemProps, args)
const pagePath = args.pagePath const pagePath = args.pagePath
const route = pagePath && __uniRoutes.find(({ path }) => path === pagePath) const route = pagePath && __uniRoutes.find(({ path }) => path === pagePath)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册