diff --git a/components/checkbox/Checkbox.vue b/components/checkbox/Checkbox.vue index 826666e5a..a8539ddf7 100644 --- a/components/checkbox/Checkbox.vue +++ b/components/checkbox/Checkbox.vue @@ -32,13 +32,13 @@ export default { prop: 'checked', }, inject: { - context: { default: undefined }, + checkboxGroupContext: { default: undefined }, }, data () { - const { context, checked, defaultChecked, value } = this + const { checkboxGroupContext, checked, defaultChecked, value } = this let stateChecked - if (context && context.checkedStatus) { - stateChecked = context.checkedStatus.has(value) + if (checkboxGroupContext && checkboxGroupContext.checkedStatus) { + stateChecked = checkboxGroupContext.checkedStatus.has(value) } return { stateChecked: stateChecked === undefined @@ -72,8 +72,8 @@ export default { handleChange (event) { const targetChecked = event.target.checked this.$emit('input', targetChecked) - const { name, value, checked, context, stateChecked } = this - if ((checked === undefined && !context) || (context && context.value === undefined)) { + const { name, value, checked, checkboxGroupContext, stateChecked } = this + if ((checked === undefined && !checkboxGroupContext) || (checkboxGroupContext && checkboxGroupContext.value === undefined)) { this.stateChecked = targetChecked } const target = { @@ -81,8 +81,8 @@ export default { value, checked: !stateChecked, } - if (this.context) { - this.context.handleChange({ target }) + if (this.checkboxGroupContext) { + this.checkboxGroupContext.handleChange({ target }) } else { this.$emit('change', { target, @@ -100,7 +100,7 @@ export default { checked (val) { this.stateChecked = val }, - 'context.checkedStatus': function (checkedStatus) { + 'checkboxGroupContext.checkedStatus': function (checkedStatus) { this.stateChecked = checkedStatus.has(this.value) }, }, diff --git a/components/checkbox/Group.vue b/components/checkbox/Group.vue index 1668f846a..31ba2252d 100644 --- a/components/checkbox/Group.vue +++ b/components/checkbox/Group.vue @@ -1,8 +1,9 @@ - {{item.label}} - + + {{item.label}} + + diff --git a/components/radio/demo/basic.vue b/components/radio/demo/basic.vue new file mode 100644 index 000000000..02c275f0c --- /dev/null +++ b/components/radio/demo/basic.vue @@ -0,0 +1,13 @@ + + + Radio + + + diff --git a/components/radio/demo/disabled.vue b/components/radio/demo/disabled.vue new file mode 100644 index 000000000..d21f027ac --- /dev/null +++ b/components/radio/demo/disabled.vue @@ -0,0 +1,31 @@ + + + Disabled + + Disabled + + + Toggle disabled + + + + + diff --git a/components/radio/demo/index.vue b/components/radio/demo/index.vue new file mode 100644 index 000000000..cf711bade --- /dev/null +++ b/components/radio/demo/index.vue @@ -0,0 +1,42 @@ + + + Basic + + Disabled + + RadioButton + + RadioGroupMore + + RadioGroupOptions + + RadioGroupWithName + + RadioGroup + + Size + + + + diff --git a/components/radio/demo/radioButton.vue b/components/radio/demo/radioButton.vue new file mode 100644 index 000000000..3ee413418 --- /dev/null +++ b/components/radio/demo/radioButton.vue @@ -0,0 +1,42 @@ + + + + + Hangzhou + Shanghai + Beijing + Chengdu + + + + + Hangzhou + Shanghai + Beijing + Chengdu + + + + + Hangzhou + Shanghai + Beijing + Chengdu + + + + + diff --git a/components/radio/demo/radioGroup-more.vue b/components/radio/demo/radioGroup-more.vue new file mode 100644 index 000000000..6ade73275 --- /dev/null +++ b/components/radio/demo/radioGroup-more.vue @@ -0,0 +1,35 @@ + + + Option A + Option B + Option C + + More... + + + + + diff --git a/components/radio/demo/radioGroup-options.vue b/components/radio/demo/radioGroup-options.vue new file mode 100644 index 000000000..6d5f55f14 --- /dev/null +++ b/components/radio/demo/radioGroup-options.vue @@ -0,0 +1,50 @@ + + + + + + + + + + diff --git a/components/radio/demo/radioGroup-with-name.vue b/components/radio/demo/radioGroup-with-name.vue new file mode 100644 index 000000000..ab272d8f7 --- /dev/null +++ b/components/radio/demo/radioGroup-with-name.vue @@ -0,0 +1,17 @@ + + + A + B + C + D + + + diff --git a/components/radio/demo/radioGroup.vue b/components/radio/demo/radioGroup.vue new file mode 100644 index 000000000..085211370 --- /dev/null +++ b/components/radio/demo/radioGroup.vue @@ -0,0 +1,27 @@ + + + A + B + C + D + + + diff --git a/components/radio/demo/size.vue b/components/radio/demo/size.vue new file mode 100644 index 000000000..2739cc763 --- /dev/null +++ b/components/radio/demo/size.vue @@ -0,0 +1,37 @@ + + + + + Hangzhou + Shanghai + Beijing + Chengdu + + + + + Hangzhou + Shanghai + Beijing + Chengdu + + + + + Hangzhou + Shanghai + Beijing + Chengdu + + + + +