可以直接在getList的then方法中打印,
倘若非要在mounted()中使用的话可以呀试下下面这种写法:
mounted() { this.getList().then(() => { console.log(this.list)
});
},
methods: {
getList() { return Promise.resolve({}).then(() => {
const param = {
id: this.listQuert.id
}; return api.workinfo(param).then(response => {
const data = response.data; this.list = data
});
})
}
}