Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

  1. 点击标题
  2. 出现弹窗
  3. 调取接口(接口中的入参是点击标题时获取到的)
  4. 当循环获取的数据时: 页面中报了一个错误

image.png

image.png
代码:

// 编辑任务
handleEdit(row) {
  // TODO: 调取任务详情接口
  this.editTasks.drawer = true;
  const params = {
    loginName: this.loginName,
    taskId: row.taskId,
  };
  this.$api.Task.taskDetail(params, (res) => {
    console.log(res);
    this.editTasks.taskData = res.task || {};
  });
},

请问大家知道怎么解决吗?
我知道报错说的是item 没有定义,我需要获取到每条数据的id,只有在点击的时候调接口才是合理的吧


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
258 views
Welcome To Ask or Share your Answers For Others

1 Answer

this.editTasks.drawer = true;

drawer 用来做 v-if 显示组件?把上面这句话也放入 ajax 里面。

这样就不会出现异步,导致组件显示的时候ajax没有返回数据。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...