https://github.com/liangxiaojuan/vue-todos/blob/master/src/mock/mock.js#L64
Opened this issue · 1 comments
laughitoff commented
Originally posted by @thoth-hank in #16 (comment)
laughitoff commented
修改后 得到一个新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
};
});
},