We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当使用van-tabbar的时候,切换页面的时候,理论上应该会随着页面改变,但是当tabbar的数量大于2的时候,切换似乎并没有改变颜色。 我的代码示例如下: // custom-tab-bar/index.wxml,; {{ item.text }} // custom-tab-bar/index.js Component({
/**
切换tabar
@param {event} event 当切换事件发生 */ onChange(event) { this.setData({ active: event.detail });
wx.switchTab({ url: this.data.list[event.detail].url });
},
init() { const page = getCurrentPages().pop(); this.setData({ active: this.data.list.findIndex(item => item.url === /${page.route}) }); } }
/${page.route}
}) app.json "tabBar": { "custom": true, "color": "#000000", "selectedColor": "#ffffff", "backgroundColor": "#000000", "list": [ { "pagePath": "pages/index/index", "text": "首页" }, { "pagePath": "pages/favorites/favorites", "text": "分类" }, { "pagePath": "pages/shopcar/shopcar", "text": "购物车" }, { "pagePath": "pages/me/index", "text": "我的" } ] }
1.10.16
van-tabbar 组件
测试代码可以参考你们提供的wxapp示例,但是需要多添加2个tabbar
No response
The text was updated successfully, but these errors were encountered:
已经解决了,感谢
Sorry, something went wrong.
No branches or pull requests
重现链接
当使用van-tabbar的时候,切换页面的时候,理论上应该会随着页面改变,但是当tabbar的数量大于2的时候,切换似乎并没有改变颜色。
我的代码示例如下:
// custom-tab-bar/index.wxml,;
{{
item.text
}}
// custom-tab-bar/index.js
Component({
/**
/
data: {
active:0,
list: [
{
icon: 'home-o',
text: '首页',
url: '/pages/index/index'
},
{
icon: 'star-o',
text: '分类',
url: '/pages/favorites/favorites'
},
{
icon: 'shopping-cart-o',
text: '购物车',
url: '/pages/shopcar/shopcar'
},
{
icon: 'friends-o',
text: '我的',
url: '/pages/me/index'
}
]
},
methods: {
/*
切换tabar
@param {event} event 当切换事件发生
*/
onChange(event) {
this.setData({ active: event.detail });
},
init() {
const page = getCurrentPages().pop();
this.setData({
active: this.data.list.findIndex(item => item.url ===
/${page.route}
)});
}
}
})
app.json
"tabBar": {
"custom": true,
"color": "#000000",
"selectedColor": "#ffffff",
"backgroundColor": "#000000",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页"
},
{
"pagePath": "pages/favorites/favorites",
"text": "分类"
},
{
"pagePath": "pages/shopcar/shopcar",
"text": "购物车"
},
{
"pagePath": "pages/me/index",
"text": "我的"
}
]
}
Vant Weapp 版本
1.10.16
描述一下你遇到的问题。
van-tabbar 组件
重现步骤
测试代码可以参考你们提供的wxapp示例,但是需要多添加2个tabbar
设备/浏览器
No response
The text was updated successfully, but these errors were encountered: