没使用vuex时方法里面this.$router.back(-1)
这样返回上一页 使用了vuex后mutations这样写报错了Cannot read property 'back' of undefined
methods: {
release () {
this.$router.back(-1)
}
}
mutations: {
RELEASE () {
this.$router.back(-1) //Cannot read property 'back' of undefined
}
}
不能使用这样的写法(Vuex只是状态管理),只能在*.vue中使用this.$router。