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` | - |
|
| name | Radio name | `any` | - |
|
||||||
| disabled | Whether to disable radio | `Boolean` | `false` |
|
| disabled | Whether to disable radio | `Boolean` | `false` |
|
||||||
| label-disabled | Whether to disable label click | `Boolean` | `false` |
|
| label-disabled | Whether to disable label click | `Boolean` | `false` |
|
||||||
|
| label-position | Can be set to `left` | `String` | `right` |
|
||||||
|
|
||||||
### RadioGroup API
|
### RadioGroup API
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
>
|
>
|
||||||
<icon :name="currentValue === name ? 'checked' : 'check'" />
|
<icon :name="currentValue === name ? 'checked' : 'check'" />
|
||||||
</span>
|
</span>
|
||||||
<span v-if="$slots.default" :class="b('label')" @click="onClickLabel">
|
<span v-if="$slots.default" :class="b('label', labelPosition)" @click="onClickLabel">
|
||||||
<slot />
|
<slot />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -29,7 +29,8 @@ export default create({
|
|||||||
name: null,
|
name: null,
|
||||||
value: null,
|
value: null,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
labelDisabled: Boolean
|
labelDisabled: Boolean,
|
||||||
|
labelPosition: Boolean
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -63,6 +63,7 @@ export default {
|
|||||||
| name | 标识 Radio 名称 | 任意类型 | - |
|
| name | 标识 Radio 名称 | 任意类型 | - |
|
||||||
| disabled | 是否为禁用状态 | `Boolean` | `false` |
|
| disabled | 是否为禁用状态 | `Boolean` | `false` |
|
||||||
| label-disabled | 是否禁用文本内容点击 | `Boolean` | `false` |
|
| label-disabled | 是否禁用文本内容点击 | `Boolean` | `false` |
|
||||||
|
| label-position | 文本位置,可选值为 `left` | `String` | `right` |
|
||||||
|
|
||||||
### RadioGroup API
|
### RadioGroup API
|
||||||
|
|
||||||
|
@ -30,9 +30,15 @@ $van-radio-size: 20px;
|
|||||||
&__label {
|
&__label {
|
||||||
line-height: $van-radio-size;
|
line-height: $van-radio-size;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|
||||||
|
&--left {
|
||||||
|
float: left;
|
||||||
|
margin: 0 10px 0 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.van-icon {
|
.van-icon {
|
||||||
|
width: 1em;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
font-size: $van-radio-size;
|
font-size: $van-radio-size;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user