project, each using the same route at the same level, and rendering different pages according to the routing parameters.
in the tree directory, clicking on each node will commit the current node information to the currentNode of vuex. Now I update the current node information in the component to get the id; of node.
there is a problem that I can"t figure out:
is going to use
watch: {
$route(val, newval){
//URLnodeId
}
}
but watch works when you click on nodes at the same level to jump, but watch does not take effect when you click on nodes at different levels.
then use the computer calculation property in the component to obtain the id; in real time through the global node information of Vuex.
computed: {
currentNode(){
return this.$store.state.currentNode
}
}
excuse me, why is this?