Skip to content
New issue

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

tabbar切换后刷新,选中状态问题 #2388

Closed
seven0106 opened this issue Jan 7, 2018 · 2 comments
Closed

tabbar切换后刷新,选中状态问题 #2388

seven0106 opened this issue Jan 7, 2018 · 2 comments

Comments

@seven0106
Copy link

seven0106 commented Jan 7, 2018

官方文档

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

尝试使用

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

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

@airyland
Copy link
Owner

airyland commented Jan 7, 2018

�这是 vue 使用的问题,不是组件问题。后退出现状态不改变说明没有正确处理 route 变化时的状态切换,可以使用 https://github.com/vuejs/vuex-router-sync 方便在 app.vue 中监听状态 computed 一个 selected 状态。

@kkxlkkxllb
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants