Commit e6c0b158e9e86a4687da559fe7048b2aa0dcb73f
1 parent
de517e39
update
update
Showing
6 changed files
with
15 additions
and
27 deletions
Show diff stats
src/components/checkbox/checkbox.vue
... | ... | @@ -81,10 +81,13 @@ |
81 | 81 | }, |
82 | 82 | mounted () { |
83 | 83 | // todo 使用 while向上查找 |
84 | - if (this.$parent && this.$parent.$options.name === 'checkboxGroup') this.group = true; | |
84 | + if (this.$parent && this.$parent.$options.name === 'CheckboxGroup') this.group = true; | |
85 | 85 | if (!this.group) { |
86 | 86 | this.updateModel(); |
87 | - if (this.$refs.slot && this.$refs.slot.innerHTML === '') { | |
87 | +// if (this.$refs.slot && this.$refs.slot.innerHTML === '') { | |
88 | +// this.showSlot = false; | |
89 | +// } | |
90 | + if (this.$slots.default === undefined) { | |
88 | 91 | this.showSlot = false; |
89 | 92 | } |
90 | 93 | } | ... | ... |
src/components/radio/radio.vue
... | ... | @@ -64,7 +64,7 @@ |
64 | 64 | }, |
65 | 65 | mounted () { |
66 | 66 | // todo 使用 while向上查找 |
67 | - if (this.$parent && this.$parent.$options.name === 'radioGroup') this.group = true; | |
67 | + if (this.$parent && this.$parent.$options.name === 'RadioGroup') this.group = true; | |
68 | 68 | if (!this.group) { |
69 | 69 | this.updateValue(); |
70 | 70 | } | ... | ... |
src/components/rate/rate.vue
src/components/tree/tree.vue
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | :value="item.checked && item.childrenCheckedStatus == 2" |
10 | 10 | :disabled="item.disabled || item.disableCheckbox" |
11 | 11 | :indeterminate="item.checked && item.childrenCheckedStatus == 1" |
12 | - @click.prevent="setCheck(item.disabled||item.disableCheckbox, index)"></Checkbox> | |
12 | + @click.native.prevent="setCheck(item.disabled||item.disableCheckbox, index)"></Checkbox> | |
13 | 13 | <a :class="titleCls(item)" @click="setSelect(item.disabled, index)"> |
14 | 14 | <span :class="[prefixCls + '-title']" v-html="item.title"></span> |
15 | 15 | </a> |
... | ... | @@ -181,7 +181,7 @@ |
181 | 181 | this.dispatch('Tree', 'nodeSelected', { |
182 | 182 | ori: this, |
183 | 183 | selected: selected |
184 | - }) | |
184 | + }); | |
185 | 185 | } |
186 | 186 | }, |
187 | 187 | setCheck (disabled, index) { | ... | ... |
src/styles/components/tree.less
test/routers/tree.vue
1 | 1 | <template> |
2 | - <div> | |
3 | - <Tree | |
4 | - v-model="treeData" | |
5 | - :show-checkbox="true" | |
6 | - :multiple="true" | |
7 | - @on-select-change="selectFn" | |
8 | - @on-check-change="checkFn"></Tree> | |
9 | - </div> | |
2 | + <Tree v-model="baseData" show-checkbox></Tree> | |
10 | 3 | </template> |
11 | 4 | <script> |
12 | 5 | export default { |
13 | - data: function() { | |
6 | + data () { | |
14 | 7 | return { |
15 | - treeData: [{ | |
8 | + baseData: [{ | |
16 | 9 | expand: true, |
17 | 10 | title: 'parent 1', |
18 | - selected: false, | |
19 | 11 | children: [{ |
20 | 12 | title: 'parent 1-0', |
21 | 13 | expand: true, |
... | ... | @@ -28,21 +20,14 @@ |
28 | 20 | }] |
29 | 21 | }, { |
30 | 22 | title: 'parent 1-1', |
23 | + expand: true, | |
31 | 24 | checked: true, |
32 | 25 | children: [{ |
33 | - title: '<span style="color: red">sss</span>', | |
26 | + title: '<span style="color: red">leaf</span>' | |
34 | 27 | }] |
35 | 28 | }] |
36 | 29 | }] |
37 | 30 | } |
38 | - }, | |
39 | - methods: { | |
40 | - selectFn(data){ | |
41 | - console.log(data); | |
42 | - }, | |
43 | - checkFn(data){ | |
44 | - console.log(data); | |
45 | - } | |
46 | 31 | } |
47 | 32 | } |
48 | 33 | </script> | ... | ... |