Commit bb1f58e20305f28166cdc401951061d15dd57466

Authored by 梁灏
1 parent f89dd9c2

update Radio

examples/routers/radio.vue
1 <template> 1 <template>
2 <div> 2 <div>
3 <Radio-group v-model="date.sex"> 3 <Radio-group v-model="date.sex">
4 - <Radio label="male form"></Radio>  
5 - <Radio label="female"></Radio> 4 + <div v-if="show">
  5 + <Radio label="male"></Radio>
  6 + <Radio label="female"></Radio>
  7 + </div>
6 </Radio-group> 8 </Radio-group>
7 <Button @click="handleChange">change</Button> 9 <Button @click="handleChange">change</Button>
8 </div> 10 </div>
@@ -12,13 +14,15 @@ @@ -12,13 +14,15 @@
12 data () { 14 data () {
13 return { 15 return {
14 date: { 16 date: {
15 - sex: ''  
16 - } 17 + sex: 'male'
  18 + },
  19 + show: false
17 } 20 }
18 }, 21 },
19 methods: { 22 methods: {
20 handleChange () { 23 handleChange () {
21 - this.date.sex = 'male form'; 24 +// this.date.sex = 'male form';
  25 + this.show = true;
22 } 26 }
23 } 27 }
24 } 28 }
src/components/radio/radio.vue
@@ -71,6 +71,8 @@ @@ -71,6 +71,8 @@
71 if (this.parent) this.group = true; 71 if (this.parent) this.group = true;
72 if (!this.group) { 72 if (!this.group) {
73 this.updateValue(); 73 this.updateValue();
  74 + } else {
  75 + this.parent.updateValue();
74 } 76 }
75 }, 77 },
76 methods: { 78 methods: {