tree树形懒加载,然后resolve出来了data,但是在想默认展示第一层,需要改下第一段代码,下面第一段代码怎么能弄成和第二段一样,resolve之后用then方法执行nextTick呢
const thatData = [{"label":"导航权限菜单","id":"","isLeaf":false}]
return resolve(thatData);
await this.$http.menuList(postData,true)
.then((res) => {
const thatData = [{"label":"导航权限菜单","id":"","isLeaf":false}]
return resolve(thatData);
})
.then(() => {
this.$nextTick(() => {
let nodeData = node.childNodes[0];
nodeData.expanded = true;
nodeData.loadData();
});
}
https://es6.ruanyifeng.com/#d...
使用
new Promise()
封装一下就可以继续then