ant-design-vue/components/tree-select/demo/multiple.md

62 lines
1.4 KiB
Markdown
Raw Normal View History

2018-07-11 09:51:20 +00:00
<cn>
#### 多选
多选的树选择。
</cn>
<us>
#### Multiple Selection
Multiple selection usage.
</us>
2019-10-09 10:32:23 +00:00
```tpl
2018-07-11 09:51:20 +00:00
<template>
<a-tree-select
showSearch
style="width: 300px"
:value="value"
:dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
2019-09-28 12:45:07 +00:00
placeholder="Please select"
2018-07-11 09:51:20 +00:00
allowClear
multiple
treeDefaultExpandAll
@change="onChange"
@search="onSearch"
@select="onSelect"
>
2019-09-28 12:45:07 +00:00
<a-tree-select-node value="parent 1" title="parent 1" key="0-1">
<a-tree-select-node value="parent 1-0" title="parent 1-0" key="0-1-1">
<a-tree-select-node value="leaf1" title="my leaf" key="random" />
<a-tree-select-node value="leaf2" title="your leaf" key="random1" />
2018-07-11 09:51:20 +00:00
</a-tree-select-node>
2019-09-28 12:45:07 +00:00
<a-tree-select-node value="parent 1-1" title="parent 1-1" key="random2">
<a-tree-select-node value="sss" key="random3">
2018-07-11 09:51:20 +00:00
<b style="color: #08c" slot="title">sss</b>
</a-tree-select-node>
</a-tree-select-node>
</a-tree-select-node>
</a-tree-select>
</template>
<script>
2019-09-28 12:45:07 +00:00
export default {
data() {
return {
value: undefined,
};
2018-07-11 09:51:20 +00:00
},
2019-09-28 12:45:07 +00:00
methods: {
onChange(value) {
console.log(value);
this.value = value;
},
onSearch() {
console.log(...arguments);
},
onSelect() {
console.log(...arguments);
},
2018-07-11 09:51:20 +00:00
},
2019-09-28 12:45:07 +00:00
};
2018-07-11 09:51:20 +00:00
</script>
```