data() { return { } }, props: ['who'],
<span @click="takeOperate(`focus${who}`,item.used_id,'')">已关注</span>
click点击事件里有三个参数,分别为:javascript
第一个`focus${who}`html
第二个item.used_idvue
第三个''java
其中第三个是空字符串,占位用;vuex
第二个是循环的变量segmentfault
第一个是focus的字符串加上本例中接收的who变量this
methods :{ takeOperate(operate,index,value){ this.takething['operate'] = operate this.takething['id'] = index; this.takething['value'] = value; }, }
触发takeOperate方法后,把相应参数存储在变量中spa
2.eslint报错eslint
解决:回车空一行code
参考文档:
1.vuex入门,详细的讲解:http://www.javashuo.com/article/p-xawnvtyt-gu.html
2.standard规范(黄色报错):https://standardjs.com/readme-zhcn.html