First, vuex is introduced into the component
import vuex from "vuex";
Second, calculate the change in the value of state
computed: { state() { return this.$store.state["MODULE_DEVICE_MONITOR"]; }},Copy the code
Finally, listen for state
- Component status monitoring
'state.selectedItem' (newVal) {
console.log(newVal)
}
Copy the code
- Push monitor
'state.deviceDataWS': {
handler (newName, oldName) {
console.log(newName, oldName)
},
deep: true,
immediate: true,
}
Copy the code