diff --git a/packages/checkbox/src/checkbox.vue b/packages/checkbox/src/checkbox.vue
index 42a9eea9a..956eb5c43 100644
--- a/packages/checkbox/src/checkbox.vue
+++ b/packages/checkbox/src/checkbox.vue
@@ -103,12 +103,6 @@
falseLabel: [String, Number]
},
- data() {
- return {
- isGroup: false
- };
- },
-
methods: {
addToStore() {
if (Array.isArray(this.model)) {
diff --git a/packages/radio/src/radio-button.vue b/packages/radio/src/radio-button.vue
index 6d9b7ba12..6d556f2a7 100644
--- a/packages/radio/src/radio-button.vue
+++ b/packages/radio/src/radio-button.vue
@@ -3,33 +3,39 @@
name: 'ElRadioButton',
props: {
- label: {
- type: [String, Number],
- required: true
- },
+ label: {},
disabled: Boolean,
name: String
},
- data() {
- return {
- size: this.$parent.size
- };
- },
computed: {
value: {
get() {
- return this.$parent.value;
+ return this._radioGroup.value;
},
- set(newValue) {
- this.$parent.$emit('input', newValue);
+ set(value) {
+ this._radioGroup.$emit('input', value);
}
},
+ _radioGroup() {
+ let parent = this.$parent;
+ while (parent) {
+ if (parent.$options.componentName !== 'ElRadioGroup') {
+ parent = parent.$parent;
+ } else {
+ return parent;
+ }
+ }
+ return false;
+ },
activeStyle() {
return {
- backgroundColor: this.$parent.fill,
- borderColor: this.$parent.fill,
- color: this.$parent.textColor
+ backgroundColor: this._radioGroup.fill,
+ borderColor: this._radioGroup.fill,
+ color: this._radioGroup.textColor
};
+ },
+ size() {
+ return this._radioGroup.size;
}
}
};
diff --git a/packages/radio/src/radio-group.vue b/packages/radio/src/radio-group.vue
index a4df33bfd..b2db8e80d 100644
--- a/packages/radio/src/radio-group.vue
+++ b/packages/radio/src/radio-group.vue
@@ -23,12 +23,8 @@
watch: {
value(value) {
this.$emit('change', value);
- this.broadcast('ElRadio', 'initData', value);
this.dispatch('ElFormItem', 'el.form.change', [this.value]);
}
- },
- mounted() {
- this.broadcast('ElRadio', 'initData', this.value);
}
};
diff --git a/packages/radio/src/radio.vue b/packages/radio/src/radio.vue
index 75b962295..d3da32b2a 100644
--- a/packages/radio/src/radio.vue
+++ b/packages/radio/src/radio.vue
@@ -4,14 +4,14 @@
{
- this.store = data;
- this.isGroup = true;
- });
+ set(val) {
+ if (this.isGroup) {
+ this.dispatch('ElRadioGroup', 'input', [val]);
+ } else {
+ this.$emit('input', val);
+ }
+ }
+ }
}
};
diff --git a/test/unit/index.js b/test/unit/index.js
index 7b2d48087..c1157e780 100644
--- a/test/unit/index.js
+++ b/test/unit/index.js
@@ -4,7 +4,7 @@ Function.prototype.bind = require('function-bind');
require('packages/theme-default/src/index.css');
// require all test files (files that ends with .spec.js)
-const testsContext = require.context('./specs', true, /tabs\.spec$/);
+const testsContext = require.context('./specs', true, /\.spec$/);
testsContext.keys().forEach(testsContext);
// require all src files except main.js for coverage.