vue中使用v-for,出现告警!
2017-11-11 11:18
447 查看
在项目中运行v-for代码段时,<flexbox v-if="roleShow" style="padding:15px; box-sizing: border-box;">
<flexbox-item v-for="role in roles " >
<x-button mini :type="role.type" style="padding: 0 14px" @click.native="btnClick(role.action)">{{role.value}}</x-button>
</flexbox-item>
</flexbox>出现告警:component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.
解决方法:
在代码中绑定key值,可解决,如:
<flexbox v-if="roleShow" style="padding:15px; box-sizing: border-box;">
<flexbox-item v-for="(role,index) in roles " :key="index" >
<x-button mini :type="role.type" style="padding: 0 14px" @click.native="btnClick(role.action)">{{role.value}}</x-button>
</flexbox-item>
</flexbox>
<flexbox-item v-for="role in roles " >
<x-button mini :type="role.type" style="padding: 0 14px" @click.native="btnClick(role.action)">{{role.value}}</x-button>
</flexbox-item>
</flexbox>出现告警:component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.
解决方法:
在代码中绑定key值,可解决,如:
<flexbox v-if="roleShow" style="padding:15px; box-sizing: border-box;">
<flexbox-item v-for="(role,index) in roles " :key="index" >
<x-button mini :type="role.type" style="padding: 0 14px" @click.native="btnClick(role.action)">{{role.value}}</x-button>
</flexbox-item>
</flexbox>
相关文章推荐
- 解决vue组件中使用v-for出现告警问题及v for指令介绍
- 基于vue中解决v-for使用报红并出现警告的问题
- springMVC 使用ajax 出现No serializer found for class异常
- vue1.0与vue2.0对于v-for的使用的区别
- 使用AlertDialog.Builder的时候出现错误:unable to add window --token null is not for an application的解决办法
- vue 使用出现的问题(持续记录)
- 使用xdebug调试出现Waiting for incoming connection with ide key XX
- vue 中使用freeze出现的问题
- 使用mybatis_generatoer工具后出现Result Maps collection already contains value for BaseResultMap
- 使用vue框架的时候出现和swiper冲突怎么办
- Keil 5 使用 Jlink 进行调试出现错误: No Algorithm found for:错误的解决过程
- 学习使用vue.js(三)条件与循环 v-if、 v-for
- ArcGIS API for Javascript 使用缓冲区结果做query查询出现“esri.config.defaults.io.proxyUrl 尚未进行设置”错误
- amCharts使用过程中出现的Invalid negative value for <rect> attribute width错误
- vscode编写vue代码v-for时出现Elements in iteration expect to have 'v-bind:key' directives.
- foobar2000使用cue文件播放时出现Unable to open item for playback (Object not found):的问题解决
- 使用vue中的v-for遍历二维数组的方法
- mac 关于使用protobuf出现ld: symbol(s) not found for architecture x86_64的问题
- 使用vue-aplayer插件时出现的问题
- vue的v-for使用