[Improvement] Checkbox: add label-position prop (#1394)

This commit is contained in:
neverland 2018-07-04 00:42:58 +08:00 committed by GitHub
parent 4fd891ac29
commit 60fcfd4d46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View File

@ -93,10 +93,11 @@ export default {
| Attribute | Description | Type | Default | | Attribute | Description | Type | Default |
|-----------|-----------|-----------|-------------| |-----------|-----------|-----------|-------------|
| v-model | Check status | `Boolean` | `false` |
| name | Checkbox name | `any` | - | | name | Checkbox name | `any` | - |
| v-model | Check status | `Boolean` | `false` |
| disabled | Diable checkbox | `Boolean` | `false` | | disabled | Diable checkbox | `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` |
| shape | Can be set to `round` `square` | `String` | `round` | | shape | Can be set to `round` `square` | `String` | `round` |
### CheckboxGroup API ### CheckboxGroup API

View File

@ -10,7 +10,7 @@
}]" }]"
@click="onClick" @click="onClick"
/> />
<span v-if="$slots.default" :class="b('label')" @click="onClick('label')"> <span v-if="$slots.default" :class="b('label', labelPosition)" @click="onClick('label')">
<slot /> <slot />
</span> </span>
</div> </div>
@ -29,6 +29,7 @@ export default create({
name: null, name: null,
value: null, value: null,
disabled: Boolean, disabled: Boolean,
labelPosition: String,
labelDisabled: { labelDisabled: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -97,10 +97,11 @@ export default {
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------|-----------|-------------| |-----------|-----------|-----------|-------------|
| v-model | 是否为选中状态 | `Boolean` | `false` |
| name | 标识 Checkbox 名称 | `any` | - | | name | 标识 Checkbox 名称 | `any` | - |
| v-model | 是否为选中状态 | `Boolean` | `false` |
| disabled | 是否禁用单选框 | `Boolean` | `false` | | disabled | 是否禁用单选框 | `Boolean` | `false` |
| label-disabled | 是否禁用单选框内容点击 | `Boolean` | `false` | | label-disabled | 是否禁用单选框内容点击 | `Boolean` | `false` |
| label-position | 文本位置,可选值为 `left` | `String` | `right` |
| shape | 形状,可选值为 `round` `square` | `String` | `round` | | shape | 形状,可选值为 `round` `square` | `String` | `round` |
### CheckboxGroup API ### CheckboxGroup API

View File

@ -25,6 +25,11 @@ $van-checkbox-size: 20px;
&__label { &__label {
margin-left: 10px; margin-left: 10px;
&--left {
float: left;
margin: 0 10px 0 0;
}
} }
&--round { &--round {