[Improvement] Radio: add label-position prop (#1446)

This commit is contained in:
neverland 2018-07-09 21:27:13 +08:00 committed by GitHub
parent b5b25ac923
commit 8c7dc1e622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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: {

View File

@ -63,6 +63,7 @@ export default {
| name | 标识 Radio 名称 | 任意类型 | - |
| disabled | 是否为禁用状态 | `Boolean` | `false` |
| label-disabled | 是否禁用文本内容点击 | `Boolean` | `false` |
| label-position | 文本位置,可选值为 `left` | `String` | `right` |
### RadioGroup API

View File

@ -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;
}