1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| import { Tag } from 'ant-design-vue'
| const { CheckableTag } = Tag
|
| export default {
| name: 'TagSelectOption',
| props: {
| prefixCls: {
| type: String,
| default: 'ant-pro-tag-select-option'
| },
| value: {
| type: [String, Number, Object],
| default: ''
| },
| checked: {
| type: Boolean,
| default: false
| }
| },
| data () {
| return {
| localChecked: this.checked || false
| }
| },
| watch: {
| 'checked' (val) {
| this.localChecked = val
| },
| '$parent.items': {
| handler: function (val) {
| this.value && val.hasOwnProperty(this.value) && (this.localChecked = val[this.value])
| },
| deep: true
| }
| },
| render () {
| const { $slots, value } = this
| const onChange = (checked) => {
| this.$emit('change', { value, checked })
| }
| return (<CheckableTag key={value} vModel={this.localChecked} onChange={onChange}>
| {$slots.default}
| </CheckableTag>)
| }
| }
|
|