您现在的位置是: 首页 > 前端开发 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 【前端开发】 5060人已围观 7935次浏览
简介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 项目完整部署方案
站长推荐
猜你喜欢
- npm 出现 Unexpected token < in JSON at position 21330
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- CentOS 安装Node.js
- Linux 查看磁盘、磁盘分区、挂载磁盘、卸载磁盘操作
- Docker 批量操作命令
- 优化 Mac 上 office 软件更新慢的问题
- Linux no space left on device 出现设备上没有空间问题
- 【代码片段】MySQL新建表添加基础字段
- 在更新python时出现dyld: Library not loaded: /usr/local/opt/libpsl/lib/libpsl.5.dylib,Reason: image not found错误解决方案
- 常见端口号