首页 > 其他 > 详细

2020/4/23 - 每日一记

时间:2020-04-23 14:51:53      阅读:64      评论:0      收藏:0      [点我收藏+]

1.vue报错Error in render: "TypeError: Cannot read property ‘length‘ of undefined"

<tr v-for="(returnExchangeProductAddRQS, index) in returnExchangeProductList">
  <td>
    <el-form-item
      :prop="‘returnExchangeProductAddRQS.‘ + index + ‘.questionContent‘">
      <el-select
        v-model="returnExchangeProductAddRQS.questionContent"
        placeholder="请选择问题描述">
        <el-option v-for="item,index in returnExchangeProductAddRQS.questionsInfoList"
                   :key="item.id"
                   :label="item.questionContent"
                   :value="item.questionContent">
        </el-option>
      </el-select>
    </el-form-item>
  </td>
</tr>

   循环的data中,又嵌套了一层数组,给外层数组添加子内容时,未给添加的子内容中的数组初始化。

 解决方案:

// 添加行数据
addDomain() {
  this.returnExchangeProductList.push({ 
    questionsInfoList: [],
  });
},

2.vue中数据嵌套层数深,数据已改变视图层未刷新

 解决方案

// 强制刷新
forceRefresh() {
  this.$forceUpdate();
},

3.elemetUI校验问题:输入框中有数据,但是校验不通过

技术分享图片

 解决方案:给定初始值

this.$set(this.form.returnExchangeProductAddRQS[index],"questionType", ‘‘);
this.$set(this.form.returnExchangeProductAddRQS[index], "questionContent", ‘‘);

 

2020/4/23 - 每日一记

原文:https://www.cnblogs.com/Ingots/p/12760596.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!