watch: {
'$store.state.loadBool'(newval, olval) {
this.loadBool = newval;
},
'$store.state.loadText'(newval, olval) {
this.loadText = newval;
}
},
mounted() {
let stateObj = this.$store.state;
this.loadBool = stateObj.loadBool;
this.loadText = stateObj.loadText;
}
这个是父组件值的变化
this.$store.commit('setLoadBool', true);
this.$store.commit('setloadText', '正在批量转账中。。。');
setTimeout(() => {
this.$store.commit('setLoadBool', false);
this.$store.commit('setloadText', '拼命加载中。。。');
}, 2000);
这个是子组件值的变化