vue 监视路由的方法

watch:{
      '$route':'isTab'

    },

methods:{
      isTab(){
        if(this.$route.path==='/index'||this.$route.path==='/gameHall'||this.$route.path==='/car'||this.$route.path==='/par'){
          this.$refs.tabItem.style.display = 'flex';
        }else {
          this.$refs.tabItem.style.display = 'none';
        }
      }
    }

  简单明了

posted @ 2017-04-19 15:12  星光璀璨的夜空  阅读(3882)  评论(0编辑  收藏  举报