computed: {
swiper() {
return this.$refs.mySwiper.$swiper;
},
LifeVal() {
return this.$store.state.LifeVal;
},
danceVal(){
return this.$store.state.danceVal;
}
},
watch: {
danceVal: function() {
LifeVal = this.$store.state.LifeVal = this.$store.state.danceVal
/* vuex : changeDanceVal是store中mutations里的方法
// 修改state的唯一方法,只允许同步函数
mutations: {
// 第一个参state值,第二个接收触发方法时传来的值
changeDanceVal(state,num) {
state.LifeVal = num;
}
},
*/
this.$store.commit("changeDanceVal", LifeVal);
}
},