您现在的位置是: 首页 > 前端开发 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 【前端开发】 4855人已围观 7663次浏览
简介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 @NotBlank 不生效问题
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- docker mysql 导入 SQL 脚本
- 优化 Mac 上 office 软件更新慢的问题
- Python自动生成和安装requirements.txt文件中的依赖
- CentOS 安装Python3
- LNMP 手动更新 SSL 证书
- PHP 在执行 composer install 时出现提示 PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
- ElasticSearch安装踩坑指南
- Vue 路由跳转错误 NavigationDuplicated: Avoided redundant navigation to current location