[new feature] Radio: add shape prop & icon slot (#2651)

This commit is contained in:
neverland
2019-01-30 20:23:26 +08:00
committed by GitHub
parent 01c893abcb
commit 76e23aefc6
12 changed files with 294 additions and 70 deletions

View File

@@ -32,6 +32,21 @@
</van-radio>
</demo-block>
<demo-block :title="$t('customIcon')">
<van-radio
name="1"
value="1"
class="demo-radio-group"
>
{{ $t('customIcon') }}
<img
slot="icon"
slot-scope="props"
:src="props.checked ? icon.active : icon.normal"
>
</van-radio>
</demo-block>
<demo-block :title="$t('withCell')">
<van-radio-group v-model="radio3">
<van-cell-group>
@@ -62,6 +77,7 @@ export default {
radio: '单选框',
text1: '未选中禁用',
text2: '选中且禁用',
customIcon: '自定义图标',
customColor: '自定义颜色',
withCell: '与 Cell 组件一起使用'
},
@@ -69,6 +85,7 @@ export default {
radio: 'Radio',
text1: 'Disabled',
text2: 'Disabled and checked',
customIcon: 'Custom Icon',
customColor: 'Custom Color',
withCell: 'Inside a Cell'
}
@@ -78,7 +95,11 @@ export default {
return {
radio1: '1',
radio2: '2',
radio3: '1'
radio3: '1',
icon: {
normal: 'https://img.yzcdn.cn/public_files/2017/10/13/c547715be149dd3faa817e4a948b40c4.png',
active: 'https://img.yzcdn.cn/public_files/2017/10/13/793c77793db8641c4c325b7f25bf130d.png'
}
};
}
};
@@ -93,5 +114,9 @@ export default {
margin-bottom: 10px;
}
}
img {
height: 20px;
}
}
</style>