forked from fanruan/fineui-custom-tutorials
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1005 B
37 lines
1005 B
4 years ago
|
# 异步分层加载
|
||
|
|
||
|
## props结构
|
||
|
```javascript
|
||
|
{
|
||
|
type: "bi.custom_tree",
|
||
|
expander: {
|
||
|
type: "bi.expander",
|
||
|
isDefaultInit: false,
|
||
|
el: {},
|
||
|
popup: {
|
||
|
type: "bi.custom_tree",
|
||
|
},
|
||
|
},
|
||
|
el: {
|
||
|
type: "bi.loader",
|
||
|
next: false,
|
||
|
el: {
|
||
|
type: "bi.button_tree",
|
||
|
chooseType: 0,
|
||
|
layouts: [
|
||
|
{
|
||
|
type: "bi.vertical",
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
itemsCreator: function(op,callback){
|
||
|
|
||
|
}
|
||
|
}
|
||
|
```
|
||
|
异步加载的props结构,el中变成了`bi.loader`,其中嵌套的el依旧是`bi.button_tree`结构,这就是FineUI嵌套的魅力
|
||
|
|
||
|
## itemsCreator实现
|
||
|
`itemsCreator`回调中第一个参数内容为当前异步,触发展开的节点存储在node属性中,注意初始第一次触发`itemsCreator`的时候因为加载的是树的第一层节点,是没有node信息的.
|
||
|
`callback`回去的内容为格式化好的下一层节点数据.
|