1.vue中的computed
(1)computed中的函数不能直接传参,即不能写成:
computed: {
showArowValue(index) {
return this.showArowArray[index];
},
},
如果需要传参,则需要使用闭包,即
computed: {
showArowValue() {
return function (index) {
return this.showArowArray[index];
};
},
},
然后在html中 :arrow-direction="showArowValue(index)
(1)computed中不能监测到数组内容的变化,只能监测到数组长度的变化,所以在method中改变数组内容时,computed相关方法不会触发,而view层的相关数据也不会更新。
需要在改变数组内容时,使用:
this.$set(this.showArowArray, index, !this.showArowArray[index]);
2.v-if失效/混乱原因
可能是在父组件使用了v-if后,又在子组件使用,且两者冲突
3.vuex全局变量在mutations中定义的set函数的调用
this.$store.commit(“setUserId”, workId);