mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 18:54:24 +00:00
[new feature] Radio: add shape prop & icon slot (#2651)
This commit is contained in:
@@ -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>
|
||||
|
Reference in New Issue
Block a user