您现在的位置是: 首页 > 前端开发 Vue 报错 Avoid using non-primitive value as key, use string/number value instead
Vue 报错 Avoid using non-primitive value as key, use string/number value instead
2020-09-09 【前端开发】 5614人已围观 9224次浏览
简介Vue 报错 Avoid using non-primitive value as key, use string/number value instead
Vue 项目开发中,控制台出现提示
Avoid using non-primitive value as key, use string/number value instead
避免使用非基元值作为键,而是使用字符串/数字值
一般出现此类提示都是因为在 v-for 循环中,绑定的 key 是对象的原因,比如
<div
v-for="item in bannerList"
:key="item">
</div>
在这种情况下,item 实际就是个对象,而不是具体的字符串或者数值,所以才会出现上面提示的报错
修改为下面的形式,将绑定的key设置为具体的内容字段即可,比如
<div
v-for="item in bannerList"
:key="item.id">
</div>
修改之后,保存刷新页面,报错提示就没有了
很赞哦! (0)
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- nuxt 项目完整部署方案
站长推荐
猜你喜欢
- SpringBoot 2.x Security security.basic.enabled=false 失效问题解决
- 解决Lost connection to MySQL server at 'reading initial communication packet' 的方法
- Vue 路由跳转错误 NavigationDuplicated: Avoided redundant navigation to current location
- npm 出现 Unexpected token < in JSON at position 21330
- 防止Time Machine备份Parallels Desktop的虚拟硬盘文件
- mybatis中大于等于小于等于的写法
- PHP 在执行 composer install 时出现提示 PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
- Oracle ORA-12541:TNS:no listener错误解决方法
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
- SpringBoot 集成 Elasticsearch 7.8.1 出现错误 Factory method 'elasticsearchRestHighLevelClient' threw exception; nested exception is java.lang.NoSuchFieldError: IGNORE_DEPRECATIONS