diff --git a/src/mixins/checkbox.js b/src/mixins/checkbox.js index 0ebfd1bc0..30d192f3d 100644 --- a/src/mixins/checkbox.js +++ b/src/mixins/checkbox.js @@ -76,10 +76,12 @@ export const CheckboxMixin = ({ parent, bem, role }) => ({ ); + const iconSize = this.iconSize || (this.parent && this.parent.iconSize); + const Children = [
{CheckIcon}
diff --git a/src/radio-group/index.js b/src/radio-group/index.js index faa6ffe2c..13c6c8cfb 100644 --- a/src/radio-group/index.js +++ b/src/radio-group/index.js @@ -8,7 +8,8 @@ export default createComponent({ props: { value: null, - disabled: Boolean + disabled: Boolean, + iconSize: [Number, String] }, watch: { diff --git a/src/radio/README.md b/src/radio/README.md index a7d89078e..58dd6af73 100644 --- a/src/radio/README.md +++ b/src/radio/README.md @@ -125,6 +125,7 @@ export default { |------|------|------|------|------| | v-model | Name of checked radio | *any* | - | - | | disabled | Disable all radios | *boolean* | `false` | - | +| icon-size | Icon size of all radios | *string \| number* | `20px` | 2.2.3 | ### Radio Events diff --git a/src/radio/README.zh-CN.md b/src/radio/README.zh-CN.md index 82dd44ad6..516a85222 100644 --- a/src/radio/README.zh-CN.md +++ b/src/radio/README.zh-CN.md @@ -118,7 +118,7 @@ export default { | name | 标识符 | *any* | - | - | | shape | 形状,可选值为 `square` | *string* | `round` | - | | disabled | 是否为禁用状态 | *boolean* | `false` | - | -| icon-size | 图标大小,默认单位为`px` | *string \| number* | `20px` | - | +| icon-size | 当前单选框的图标大小,默认单位为`px` | *string \| number* | `20px` | - | | label-disabled | 是否禁用文本内容点击 | *boolean* | `false` | - | | label-position | 文本位置,可选值为 `left` | *string* | `right` | - | | checked-color | 选中状态颜色 | *string* | `#1989fa` | - | @@ -129,6 +129,7 @@ export default { |------|------|------|------|------| | v-model | 当前选中项的标识符 | *any* | - | - | | disabled | 是否禁用所有单选框 | *boolean* | `false` | - | +| icon-size | 所有单选框的图标大小,默认单位为`px` | *string \| number* | `20px` | 2.2.3 | ### Radio Events diff --git a/src/radio/test/__snapshots__/index.spec.js.snap b/src/radio/test/__snapshots__/index.spec.js.snap new file mode 100644 index 000000000..2d3175c50 --- /dev/null +++ b/src/radio/test/__snapshots__/index.spec.js.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`icon-size prop 1`] = ` +
+ + + +
+`; diff --git a/src/radio/test/index.spec.js b/src/radio/test/index.spec.js index d95da8664..1b27853fe 100644 --- a/src/radio/test/index.spec.js +++ b/src/radio/test/index.spec.js @@ -1,25 +1,25 @@ +import Vue from 'vue'; import Radio from '..'; import RadioGroup from '../../radio-group'; import { mount } from '../../../test/utils'; +Vue.use(Radio); +Vue.use(RadioGroup); + test('radio-group change', () => { const wrapper = mount({ template: ` - - + label - - + + `, - components: { - Radio, - RadioGroup - }, data() { return { result: 'a', @@ -47,20 +47,16 @@ test('radio-group change', () => { test('radio group disabled', () => { const wrapper = mount({ template: ` - - + label - - + + `, - components: { - Radio, - RadioGroup - }, data() { return { result: 'a', @@ -74,3 +70,17 @@ test('radio group disabled', () => { expect(wrapper.emitted('change')).toBeFalsy(); }); + +test('icon-size prop', () => { + const wrapper = mount({ + template: ` + + label + label + label + + ` + }); + + expect(wrapper).toMatchSnapshot(); +});