mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] Radio: add label-position prop (#1446)
This commit is contained in:
parent
b5b25ac923
commit
8c7dc1e622
@ -61,6 +61,7 @@ export default {
|
||||
| name | Radio name | `any` | - |
|
||||
| disabled | Whether to disable radio | `Boolean` | `false` |
|
||||
| label-disabled | Whether to disable label click | `Boolean` | `false` |
|
||||
| label-position | Can be set to `left` | `String` | `right` |
|
||||
|
||||
### RadioGroup API
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
>
|
||||
<icon :name="currentValue === name ? 'checked' : 'check'" />
|
||||
</span>
|
||||
<span v-if="$slots.default" :class="b('label')" @click="onClickLabel">
|
||||
<span v-if="$slots.default" :class="b('label', labelPosition)" @click="onClickLabel">
|
||||
<slot />
|
||||
</span>
|
||||
</div>
|
||||
@ -29,7 +29,8 @@ export default create({
|
||||
name: null,
|
||||
value: null,
|
||||
disabled: Boolean,
|
||||
labelDisabled: Boolean
|
||||
labelDisabled: Boolean,
|
||||
labelPosition: Boolean
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
@ -63,6 +63,7 @@ export default {
|
||||
| name | 标识 Radio 名称 | 任意类型 | - |
|
||||
| disabled | 是否为禁用状态 | `Boolean` | `false` |
|
||||
| label-disabled | 是否禁用文本内容点击 | `Boolean` | `false` |
|
||||
| label-position | 文本位置,可选值为 `left` | `String` | `right` |
|
||||
|
||||
### RadioGroup API
|
||||
|
||||
|
@ -30,9 +30,15 @@ $van-radio-size: 20px;
|
||||
&__label {
|
||||
line-height: $van-radio-size;
|
||||
margin-left: 10px;
|
||||
|
||||
&--left {
|
||||
float: left;
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.van-icon {
|
||||
width: 1em;
|
||||
pointer-events: none;
|
||||
font-size: $van-radio-size;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user