2018-07-11 17:51:20 +08:00
|
|
|
<cn>
|
|
|
|
#### 可勾选
|
|
|
|
使用勾选框实现多选功能。
|
|
|
|
</cn>
|
|
|
|
|
|
|
|
<us>
|
|
|
|
#### Checkable
|
|
|
|
Multiple and checkable.
|
|
|
|
</us>
|
|
|
|
|
|
|
|
```html
|
|
|
|
<template>
|
|
|
|
<a-tree-select
|
|
|
|
style="width: 300px"
|
|
|
|
:treeData="treeData"
|
|
|
|
:value="value"
|
|
|
|
@change="onChange"
|
|
|
|
treeCheckable
|
|
|
|
:showCheckedStrategy="SHOW_PARENT"
|
|
|
|
searchPlaceholder='Please select'
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-08-04 17:52:11 +08:00
|
|
|
import { TreeSelect } from 'ant-design-vue'
|
2018-07-11 17:51:20 +08:00
|
|
|
const SHOW_PARENT = TreeSelect.SHOW_PARENT
|
|
|
|
|
|
|
|
const treeData = [{
|
2018-12-25 12:00:39 +08:00
|
|
|
title: 'Node1',
|
2018-07-11 17:51:20 +08:00
|
|
|
value: '0-0',
|
|
|
|
key: '0-0',
|
|
|
|
children: [{
|
2018-12-25 12:00:39 +08:00
|
|
|
title: 'Child Node1',
|
2018-07-11 17:51:20 +08:00
|
|
|
value: '0-0-0',
|
|
|
|
key: '0-0-0',
|
|
|
|
}],
|
|
|
|
}, {
|
2018-12-25 12:00:39 +08:00
|
|
|
title: 'Node2',
|
2018-07-11 17:51:20 +08:00
|
|
|
value: '0-1',
|
|
|
|
key: '0-1',
|
|
|
|
children: [{
|
2018-12-25 12:00:39 +08:00
|
|
|
title: 'Child Node3',
|
2018-07-11 17:51:20 +08:00
|
|
|
value: '0-1-0',
|
|
|
|
key: '0-1-0',
|
|
|
|
disabled: true,
|
|
|
|
}, {
|
2018-12-25 12:00:39 +08:00
|
|
|
title: 'Child Node4',
|
2018-07-11 17:51:20 +08:00
|
|
|
value: '0-1-1',
|
|
|
|
key: '0-1-1',
|
|
|
|
}, {
|
2018-12-25 12:00:39 +08:00
|
|
|
title: 'Child Node5',
|
2018-07-11 17:51:20 +08:00
|
|
|
value: '0-1-2',
|
|
|
|
key: '0-1-2',
|
|
|
|
}],
|
|
|
|
}]
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
value: ['0-0-0'],
|
|
|
|
treeData,
|
|
|
|
SHOW_PARENT,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onChange (value) {
|
2018-12-25 12:00:39 +08:00
|
|
|
console.log('onChange ', value)
|
2018-07-11 17:51:20 +08:00
|
|
|
this.value = value
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
```
|