提交 f9b6cf49 编写于 作者: laizhilong's avatar laizhilong

修改下拉树初始化回调逻辑

上级 c4fd2a75
......@@ -79,33 +79,35 @@
}
tempData.push(tempItem);
});
// 给树赋值
this.options = tempData;
this.$nextTick(() => {
// 树
let tree: any = this.$refs.selectTree;
// 第一个叶子节点
let firstNode:any = {};
if (tempData[0].apps) {
firstNode = tempData[0].apps;
}else {
firstNode = tempData[0];
}
// 设置树当前选中值
// 下拉树
let tree: any = this.$refs.selectTree;
// 第一个叶子节点
let firstNode:any = {};
if (tempData[0].apps) {
firstNode = tempData[0].apps;
}else {
firstNode = tempData[0];
}
// 从local中拿刷新前选中值
if (localStorage.getItem('localdata')) {
const localdata:any = JSON.parse(localStorage.getItem('localdata') as string);
this.valueId = localdata.dstappid;
this.valueTitle = localdata.title;
this.defaultExpandedKey.push(localdata.dstappid);
// 设置下拉树选中值
tree.setCurrentKey(localdata.dstappid);
}else {
// 设置下拉框默认值
this.valueId = firstNode[0].id;
this.valueTitle = firstNode[0].systemId + "-" + firstNode[0].label;
this.defaultExpandedKey.push(firstNode[0].id);
// 设置下拉树选中值
tree.setCurrentKey(firstNode[0].id);
// 从local中拿刷新前选中值
if (localStorage.getItem('localdata')) {
const localdata:any = JSON.parse(localStorage.getItem('localdata') as string);
this.valueId = localdata.dstappid;
this.valueTitle = localdata.title;
this.defaultExpandedKey.push(localdata.dstappid);
}else {
// 设置下拉框默认值
this.valueId = firstNode[0].id;
this.valueTitle = firstNode[0].systemId + "-" + firstNode[0].label;
this.defaultExpandedKey.push(firstNode[0].id);
}
});
}
}
} else {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册