Skip to content

Conversation

yiminghe
Copy link
Member

<cascade loadData={
function(selectedOptions){
const options = this.state.options;
    const targetOption = selectedOptions[selectedOptions.length - 1];
    targetOption.label += ' loading';
    // 动态加载下级数据
    setTimeout(() => {
      targetOption.label = targetOption.label.replace(' loading', '');
      targetOption.children = [{
        'label': targetOption.label + '动态加载1',
        'value': 'dynamic1',
      }, {
        'label': targetOption.label + '动态加载2',
        'value': 'dynamic2',
      }];
      this.setState({options});
    }, 1000);
    this.setState({options});
}
}>

@yiminghe
Copy link
Member Author

等下再改下合

@yiminghe
Copy link
Member Author

@warmhug @afc163

和 tree/tree-select 一样的需求

@afc163
Copy link
Member

afc163 commented Dec 30, 2015

isLeaf 很不优雅啊,和是否有 children 表达的信息重复了。而且如果子数据是动态获取的?

@warmhug
Copy link

warmhug commented Dec 30, 2015

动态加载的时候,各级节点的 children 都是空或没设置。需要一个标记,类似 isLeaf ,如果是 leaf 节点,展现上 就是不能再点击 ,就不再发请求加载数据了。

afc163 added a commit that referenced this pull request Dec 30, 2015
@afc163 afc163 merged commit 56a608c into master Dec 30, 2015
@afc163 afc163 deleted the onSelect branch December 30, 2015 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants