vscode编写vue代码v-for时出现Elements in iteration expect to have 'v-bind:key' directives.
2018-02-17 23:41
1031 查看
在用vscode编写vue代码时,因为安装的有vetur插件,所以当代码中有v-for语法时,会提示[vue-language-server] 'v-for' directives require 'v-bind:key' directives.
我们知道vue在升级到2.2后,当在组件中使用
下面是vue官方文档的说明:
回头看一下,我们写的代码 v-for中有key,但是为什么还报错呢?去vetur插件的github上搜了一下,发现有人提这个报错问题,该插件的作者给出了解决办法:This is intended ESLint feature. You can turn off eslint check in future release. Setting
我们知道vue在升级到2.2后,当在组件中使用
v-for时,
key现在是必须的。
下面是vue官方文档的说明:
回头看一下,我们写的代码 v-for中有key,但是为什么还报错呢?去vetur插件的github上搜了一下,发现有人提这个报错问题,该插件的作者给出了解决办法:This is intended ESLint feature. You can turn off eslint check in future release. Setting
vetur.validation.vue-htmlto false will disable it.这是ESLint的功能。对vue进行了eslint检查。那么我们就把eslint对该插件的检查关闭,在vscode中,打开 文件>首选项>设置 找到 vetur.configuration 把 "vetur.validation.template": true 改成"vetur.validation.template": false 保存,我们再看一下vue文件,发现不报错了。
相关文章推荐
- vue开发中v-for在Eslint的规则检查下出现:Elements in iteration expect to have 'v-bind:key' directives
- vue 出现Elements in iteration expect to have 'v-bind:key' directives问题
- vue 出现Elements in iteration expect to have 'v-bind:key' directives问题
- vetur插件提示 [vue-language-server] Elements in iteration expect to have 'v-bind:key' directives错误的解决办法
- vscode中vetur插件 [vue-language-server] Elements in iteration expect to have 'v-bind:key' directives错误
- Elements in iteration expect to have 'v-bind:key' directives
- v-for报"Elements in iteration expect to have 'v-bind:key' directives"错误的解决方案
- Lamp环境下编写PHP代码时出现错误:Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
- Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key.
- EJB3: Mapping of 1-to-1 relationships when primary key in the source table is also a foreign key for the target entity
- Key factors to look for in a motor insurance
- Vue 2.0 v-for 响应式key, index及item.id参数对v-bind:key值造成差异研究
- 数据库出现 Incorrect key file for table ‘test’; try to repair it
- Key words for use in RFCs to Indicate Requirement Levels
- #455 – Using ItemContainerStyle to Bind Data Elements in a Collection to a Grid
- 使用PreparedStatement,出现You have an error in your SQL syntax; check the manual that corresponds to you
- 如何使用th:each属性迭代模板-原标题:How To Use th:each For Iteration In Thymeleaf Template?
- 解决mysqldump 出现Incorrect key file for xxx; try to repair it
- eclipse中出现Cannot bind to local 8601 for debugger解决方法
- xcode 运行出现类似-[__NSCFString objectForKey:]: unrecognized selector sent to instance的调试方法