Open laughitoff opened 5 years ago
修改后 得到一个新error Uncaught (in promise) TypeError: Cannot read property 'id' of undefined
methods: { init() { // 获取到 $route下params下的id,即我们在menus.vue组件处传入的数据。 const ID = this.$route.params.id; getTodo({ id: ID }).then(res => { //错误在这一行
let { id, title, count, isDelete, locked, record
} = res.data.todo;
// 请求成功,拿到res.data.todo;在将record 赋值到代办单项列表,其它数据赋值到todo对象
this.items = record;
this.todo = {
id: id,
title: title,
count: count,
locked: locked,
isDelete: isDelete
};
});
},
Originally posted by @thoth-hank in https://github.com/liangxiaojuan/vue-todos/issues/16#issuecomment-432904621