Environment: rails webpacker: vue + vuex + vue-router + iview
problem: change the state value through mutation, and through the vue browser debugging tool, you can see that mutation triggers normally, but the variable for computed to get the corresponding state value is still the initial value of state
Test: pull the item: https://github.com/gorails-screencasts/vuejs-trello-clone, is tested in it, and the performance is normal
PPPPPPPPPPPPPPPPPP+
like the vuejs-trello-clone project, turbolink, is enabled but does not help. The problem remains
PPPPPPPPPPPPPPPPPP+
add:
// store.js
state: {
testObj: {},
test: false
},
mutations: {
updateObj (state, obj) {
state.testObj = obj
},
updateTest (state, value) {
state.test = value
}
}
// pageA.vue path:"/pagea" name: "pagea"
this.$store.commit("updateObj", objData)
this.$store.commit("updateTest", true)
// comB.vue pageA
computed: {
test() {
return this.$store.state.test
},
testObj() {
return this.$store.state.testObj
}
}
the main process of simplification is as above. It is estimated that the whole project must be attached to find the cause of the problem.
PPPPPPPPPPPPPPPPPPPPPPPP
2018-04-12 add:
problem recurrence demo:
startup project can be tested on the home page