官方文档
selected 是否选中当前项,你也可以使用v-model来指定选中的tabbar-item的index
不知道用什么方式去解决刷新问题
给路由加上 linkActiveClass: "active", 也不管用
尝试使用
created() {
if(this.active[this.$route.name]) {
this.tabActive = this.active[this.$route.name]
}
}
获取路由hash方式去解决,后退时出现了状态不改变的情况。请大神指点
这是 vue 使用的问题,不是组件问题。后退出现状态不改变说明没有正确处理 route 变化时的状态切换,可以使用 https://github.com/vuejs/vuex-router-sync 方便在 app.vue 中监听状态 computed 一个 selected 状态。
watch: {
'$route': function (newV) {
this.actived = this.tabList.findIndex(i => i.path === newV.path)
}
},
Most helpful comment