可自定义或编辑单选框
import { Radio, RadioBox, RadioGroup, RadioList } from 'mand-mobile'
Vue.component(Radio.name, Radio)
Vue.component(RadioBox.name, RadioBox)
Vue.component(RadioGroup.name, RadioGroup)
Vue.component(RadioList.name, RadioList)
| 属性 |
说明 |
类型 |
默认值 |
备注 |
| v-model |
选中项的name |
any |
- |
|
| name |
唯一键值 |
any |
- |
- |
| label |
描述文案 |
String- |
- |
|
| disabled |
是否禁用选项 |
Boolean |
false |
- |
| inline |
是否内联显示 |
Boolean |
false |
- |
| icon |
选中项的图标 |
String |
checked |
- |
| icon-inverse |
非选中项的图标 |
String |
check |
- |
| icon-disabled |
禁用项的图标 |
String |
check-disabled |
- |
| icon-svg |
使用svg图标 |
Boolean |
false |
- |
| size |
图标大小 |
String |
md |
- |
单选框 2.5.0+
| 属性 |
说明 |
类型 |
默认值 |
备注 |
| name |
唯一键值 |
any |
true |
当选中时,双向绑定的值 |
| v-model |
选中的值 |
any |
false |
- |
| disabled |
是否禁用选择 |
Boolean |
false |
- |
单选组,用以选中多个单选项。与Radio或RadioBox组合使用 2.5.0+
| 属性 |
说明 |
类型 |
默认值 |
备注 |
| v-model |
选中的值 |
Array |
- |
- |
| 参数 |
说明 |
类型 |
默认值 |
| name |
需要选中的键值 |
String |
- |
| 属性 |
说明 |
类型 |
默认值 |
备注 |
| v-model |
选中项的value |
any |
- |
|
| options |
选项数据源 |
Array<{text, value, disabled, ...}> |
[] |
disabled为选项是否禁用 |
| has-input |
是否具有可编辑项 |
Boolean |
false |
- |
| input-label |
可编辑项的名称 |
String |
- |
仅用于has-input为true |
| input-placeholder |
可编辑项的占位提示 |
String |
- |
仅用于has-input为true |
| icon |
选中项的图标 |
String |
checked |
- |
| icon-inverse |
非选中项的图标 |
String |
check |
- |
| icon-disabled |
禁用项的图标 |
String |
check-disabled |
- |
| icon-size |
图标大小 |
String |
lg |
- |
| icon-svg |
使用svg图标 |
Boolean |
false |
- |
| icon-position |
图标位置 |
String |
left |
left, right |
| is-slot-scope |
是否强制使用或不使用slot-scope |
Boolean |
- |
某些情况下需要根据业务逻辑动态确定是否使用,可避免直接组件上加if/else |
设置选中项
| 参数 |
说明 |
类型 |
| value |
选中项的value |
String |
切换选中项事件
| 属性 |
说明 |
类型 |
| option |
当前选中项的数据 |
Object:{text, value, disabled, ...} |
| index |
当前选中项的索引 |
Number |
<template>
<md-radio-list :options="data">
<template slot-scope="{ option, index, selected }">
<div class="custom-title" v-text="option.text"></div>
<div class="custom-brief">{{ option.text }}的自定义描述</div>
</template>
</md-radio-list>
</template>