Commit d44f99fd15dab6d8ab66f8b174768cf369d527d9
Committed by
GitHub

1 parent
c45f05dd
修复RadioGroup只能在使用v-model绑定的情况下才能正常使用的bug。
使用:value绑定的时候,RadioGroup并不能正常切换。
Showing
1 changed file
with
5 additions
and
3 deletions
Show diff stats
src/components/radio/radio-group.vue
@@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
67 | this.childrens = findComponentsDownward(this, 'Radio'); | 67 | this.childrens = findComponentsDownward(this, 'Radio'); |
68 | if (this.childrens) { | 68 | if (this.childrens) { |
69 | this.childrens.forEach(child => { | 69 | this.childrens.forEach(child => { |
70 | - child.currentValue = this.value === child.label; | 70 | + child.currentValue = this.currentValue === child.label; |
71 | child.group = true; | 71 | child.group = true; |
72 | }); | 72 | }); |
73 | } | 73 | } |
@@ -82,8 +82,10 @@ | @@ -82,8 +82,10 @@ | ||
82 | }, | 82 | }, |
83 | watch: { | 83 | watch: { |
84 | value () { | 84 | value () { |
85 | - this.currentValue = this.value; | ||
86 | - this.updateValue(); | 85 | + if(this.currentValue !== this.value;){ |
86 | + this.currentValue = this.value; | ||
87 | + this.updateValue(); | ||
88 | + } | ||
87 | } | 89 | } |
88 | } | 90 | } |
89 | }; | 91 | }; |