使用VSCode开发Vue项目,用ESlint进行规则检查时v-for报错:Expected ‘v-bind:key’ directives to use the viriables which are defined by the ‘v-for’ directive.
解决办法:把index定义在v-for中定义的变量里即可。
示例:
<div v-for="titile in titles" :key="title.index">{{ name }}</div>
使用VSCode开发Vue项目,用ESlint进行规则检查时v-for报错:Expected ‘v-bind:key’ directives to use the viriables which are defined by the ‘v-for’ directive.
解决办法:把index定义在v-for中定义的变量里即可。
示例:
<div v-for="titile in titles" :key="title.index">{{ name }}</div>