沒(méi)使用vuex時(shí)方法里面this.$router.back(-1)這樣返回上一頁(yè) 使用了vuex后mutations這樣寫(xiě)報(bào)錯(cuò)了Cannot read property 'back' of undefinedmethods: {
release () {
this.$router.back(-1)
}
}mutations: {
RELEASE () { this.$router.back(-1) //Cannot read property 'back' of undefined
}
}
1 回答

慕尼黑8549860
TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超11個(gè)贊
不能使用這樣的寫(xiě)法(Vuex只是狀態(tài)管理),只能在*.vue中使用this.$router。
添加回答
舉報(bào)
0/150
提交
取消