Vux: tabbar切换后刷新,选中状态问题

Created on 7 Jan 2018  ·  2Comments  ·  Source: airyland/vux

官方文档

selected 是否选中当前项,你也可以使用v-model来指定选中的tabbar-item的index
不知道用什么方式去解决刷新问题
给路由加上 linkActiveClass: "active", 也不管用

尝试使用

        created() {
            if(this.active[this.$route.name]) {
                this.tabActive = this.active[this.$route.name]
            }
        }

获取路由hash方式去解决,后退时出现了状态不改变的情况。请大神指点

componentabbar not vux's issue

Most helpful comment

  watch: {
    '$route': function (newV) {
      this.actived = this.tabList.findIndex(i => i.path === newV.path)
    }
  },

All 2 comments

这是 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)
    }
  },
Was this page helpful?
0 / 5 - 0 ratings

Related issues

chengjs picture chengjs  ·  4Comments

skyshirt picture skyshirt  ·  4Comments

hezhiwen940420 picture hezhiwen940420  ·  4Comments

hao-li picture hao-li  ·  3Comments

GloriaCHL picture GloriaCHL  ·  4Comments