鍍金池/ 問答/HTML/ 在vue組件內 beforeRouteLeave函數(shù)怎么訪問vuex?

在vue組件內 beforeRouteLeave函數(shù)怎么訪問vuex?

beforeRouteLeave: (to, from, next) => {

        console.log(to);
       // console.log(this.$store.state.goodsSerchData)   提示underfind
        // this.store.commit('changeGoodsTet');提示underfind
        next()
    }
回答
編輯回答
硬扛

在頁面引入store 例如:import store from '../vuex/index'

2018年6月28日 03:04