問(wèn)題描述使用了VueX和vue-router的Vue項(xiàng)目中,在store.js中importrouter在router.js中importstore在main.js中同時(shí)importstore和router導(dǎo)致出錯(cuò)相關(guān)代碼//請(qǐng)把代碼文本粘貼到下方(請(qǐng)勿用圖片代替代碼)main.js中importVuefrom'vue'importAppfrom'./App.vue'importstorefrom'./store'importrouterfrom'./router'router.js中importstorefrom'./store'varrouter=newRouter({routes:[{path:'/',redirect:function(){//此處需要通過(guò)查詢store中儲(chǔ)存的權(quán)限,判斷應(yīng)該讓用戶去哪個(gè)頁(yè)面,所以引入了store}}]})store.js中importVuefrom'vue'importVuexfrom'vuex'importrouterfrom'./router'Vue.use(Vuex);varstore=newVuex.Store({mutations:{logout(state){router.push("/login");//此處需要跳轉(zhuǎn)到登錄頁(yè),因此引入了router}}})你期待的結(jié)果是什么?實(shí)際看到的錯(cuò)誤信息又是什么?
萌新!vue中,store.js和router.js怎么互相調(diào)用求指導(dǎo)!
喵喵時(shí)光機(jī)
2019-10-10 17:12:43