diff --git a/CHANGE.md b/CHANGE.md
new file mode 100644
index 00000000..3e89c5fa
--- /dev/null
+++ b/CHANGE.md
@@ -0,0 +1,6 @@
+### Input
+使用 v-model
+### RadioGroup
+使用 v-model
+### Radio
+value 改为了 label,使用 v-model,废弃 checked
diff --git a/README.md b/README.md
index ba1e3a22..81fe8fca 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@
- [x] Button
- [x] Icon
- [x] Input
-- [ ] Radio
+- [x] Radio
- [ ] Checkbox
- [ ] Switch
- [ ] Table
diff --git a/src/components/affix/affix.vue b/src/components/affix/affix.vue
index e315caff..0cb7a961 100644
--- a/src/components/affix/affix.vue
+++ b/src/components/affix/affix.vue
@@ -39,6 +39,7 @@
}
export default {
+ name: 'Affix',
props: {
offsetTop: {
type: Number,
diff --git a/src/components/button/button-group.vue b/src/components/button/button-group.vue
index de2f624a..edd83fb2 100644
--- a/src/components/button/button-group.vue
+++ b/src/components/button/button-group.vue
@@ -9,6 +9,7 @@
const prefixCls = 'ivu-btn-group';
export default {
+ name: 'buttonGroup',
props: {
size: {
validator (value) {
diff --git a/src/components/button/button.vue b/src/components/button/button.vue
index 8bb5b83f..e3c4623d 100644
--- a/src/components/button/button.vue
+++ b/src/components/button/button.vue
@@ -12,6 +12,7 @@
const prefixCls = 'ivu-btn';
export default {
+ name: 'Button',
components: { Icon },
props: {
type: {
diff --git a/src/components/icon/icon.vue b/src/components/icon/icon.vue
index 787df6c1..d3371f8d 100644
--- a/src/components/icon/icon.vue
+++ b/src/components/icon/icon.vue
@@ -5,6 +5,7 @@
const prefixCls = 'ivu-icon';
export default {
+ name: 'Icon',
props: {
type: String,
size: [Number, String],
diff --git a/src/components/input/input.vue b/src/components/input/input.vue
index ca181987..eb87d804 100644
--- a/src/components/input/input.vue
+++ b/src/components/input/input.vue
@@ -48,6 +48,7 @@
const prefixCls = 'ivu-input';
export default {
+ name: 'Input',
props: {
type: {
validator (value) {
diff --git a/src/components/radio/radio-group.vue b/src/components/radio/radio-group.vue
index 12bfc20f..f66250c8 100644
--- a/src/components/radio/radio-group.vue
+++ b/src/components/radio/radio-group.vue
@@ -11,7 +11,7 @@
export default {
name: 'radioGroup',
props: {
- model: {
+ value: {
type: [String, Number],
default: ''
},
@@ -30,6 +30,11 @@
default: false
}
},
+ data () {
+ return {
+ currentValue: this.value
+ }
+ },
computed: {
classes () {
return [
@@ -42,27 +47,29 @@
];
}
},
- compiled () {
- this.updateModel();
+ mounted () {
+ this.updateValue();
},
methods: {
- updateModel () {
- const model = this.model;
+ updateValue () {
+ const value = this.value;
this.$children.forEach((child) => {
- child.selected = model == child.value;
+ child.currentValue = value == child.label;
child.group = true;
});
},
change (data) {
- this.model = data.value;
- this.updateModel();
+ this.currentValue = data.value;
+ this.updateValue();
+ this.$emit('input', data.value);
this.$emit('on-change', data.value);
- this.$dispatch('on-form-change', data.value);
+ // todo 事件
+// this.$dispatch('on-form-change', data.value);
}
},
watch: {
- model () {
- this.updateModel();
+ value () {
+ this.updateValue();
}
}
};
diff --git a/src/components/radio/radio.vue b/src/components/radio/radio.vue
index da481277..3c7e7371 100644
--- a/src/components/radio/radio.vue
+++ b/src/components/radio/radio.vue
@@ -6,31 +6,32 @@
type="radio"
:class="inputClasses"
:disabled="disabled"
- :checked="selected"
+ :checked="currentValue"
@change="change">
- {{ value }}
+ {{ label }}