zoukankan      html  css  js  c++  java
  • [Vue warn]: Avoid using non-primitive value as key

    
    
    <el-select v-model="addform.province" placeholder="请选择省份" multiple>
                <el-option
                  v-for="item in provinces"
                  :key="item"
                  :label="item.value"
                  :value="item.value"
                ></el-option>
              </el-select>

    这里的[Vue warn]是指不要用对象或是数组作为key,用string或value作为key。
    你这里很明显item是对象,:key相当于是索引的作用,提高循环性能,如果循环量较小,不写也可以的。

    改为 item.value或其他字段就OK 了

  • 相关阅读:
    index()方法
    extend()方法
    count()方法
    copy()方法
    clear()方法
    append()方法
    IE botton 点击文字下沉
    IE滚动条
    关闭windows10自动更新
    vue文件名规范
  • 原文地址:https://www.cnblogs.com/mafeng/p/11670126.html
Copyright © 2011-2022 走看看