@@ -25,13 +47,19 @@ exports[`renders demo correctly 1`] = `
diff --git a/packages/radio/test/index.spec.js b/packages/radio/test/index.spec.js
new file mode 100644
index 000000000..571b6ae3e
--- /dev/null
+++ b/packages/radio/test/index.spec.js
@@ -0,0 +1,45 @@
+import Radio from '..';
+import RadioGroup from '../../radio-group';
+import { mount } from '../../../test/utils';
+
+test('radio-group change', () => {
+ const wrapper = mount({
+ template: `
+
+
+ label
+
+
+ `,
+ components: {
+ Radio,
+ RadioGroup
+ },
+ data() {
+ return {
+ result: 'a',
+ list: ['a', 'b', 'c', 'd']
+ };
+ }
+ });
+
+ const icons = wrapper.findAll('.van-radio__icon');
+ const labels = wrapper.findAll('.van-radio__label');
+
+ icons.at(2).trigger('click');
+ expect(wrapper.vm.result).toEqual('c');
+ expect(wrapper.emitted('change')[0][0]).toEqual('c');
+
+ labels.at(1).trigger('click');
+ expect(wrapper.vm.result).toEqual('b');
+ expect(wrapper.emitted('change')[1][0]).toEqual('b');
+
+ icons.at(3).trigger('click');
+ labels.at(3).trigger('click');
+ expect(wrapper.vm.result).toEqual('b');
+});
diff --git a/packages/radio/zh-CN.md b/packages/radio/zh-CN.md
index 20c235507..95e6b1f9a 100644
--- a/packages/radio/zh-CN.md
+++ b/packages/radio/zh-CN.md
@@ -48,6 +48,33 @@ export default {
复选框
```
+#### 自定义图标
+
+通过 icon 插槽自定义图标,可以通过 `slot-scope` 判断是否为选中状态
+
+```html
+
+ 自定义图标
+
+
+```
+
+```js
+export default {
+ data() {
+ checked: true,
+ icon: {
+ normal: '//img.yzcdn.cn/icon-normal.png',
+ active: '//img.yzcdn.cn/icon-active.png'
+ }
+ }
+}
+```
+
#### 与 Cell 组件一起使用
此时你需要再引入`Cell`和`CellGroup`组件。
@@ -70,6 +97,7 @@ export default {
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|------|------|------|------|------|
| name | 标识符 | 任意类型 | - | - |
+| shape | 形状,可选值为 `square` | `String` | `round` | 1.5.8 |
| disabled | 是否为禁用状态 | `Boolean` | `false` | - |
| label-disabled | 是否禁用文本内容点击 | `Boolean` | `false` | 1.1.13 |
| label-position | 文本位置,可选值为 `left` | `String` | `right` | 1.1.13 |
@@ -87,3 +115,10 @@ export default {
| 事件名称 | 说明 | 回调参数 |
|------|------|------|
| change | 当绑定值变化时触发的事件 | 当前选中项的 name |
+
+### Radio 插槽
+
+| 名称 | 说明 | slot-scope |
+|------|------|------|
+| - | 自定义文本 | - |
+| icon | 自定义图标 | checked: 是否为选中状态 |
diff --git a/packages/style/var.less b/packages/style/var.less
index 530df54ea..edd33aa1c 100644
--- a/packages/style/var.less
+++ b/packages/style/var.less
@@ -97,6 +97,14 @@
// Radio
@radio-size: 20px;
+@radio-border-color: @gray-light;
+@radio-transition-duration: .2s;
+@radio-label-margin: 10px;
+@radio-label-color: @text-color;
+@radio-checked-icon-color: @blue;
+@radio-disabled-icon-color: @gray;
+@radio-disabled-label-color: @gray;
+@radio-disabled-background-color: @border-color;
// Swipe
@swipe-indicator: 6px;