diff --git a/docs/demos/views/checkbox.vue b/docs/demos/views/checkbox.vue index 77363778b..e3962cf1b 100644 --- a/docs/demos/views/checkbox.vue +++ b/docs/demos/views/checkbox.vue @@ -32,7 +32,7 @@ - + {{ $t('checkbox') }} {{ item }} @@ -56,7 +56,7 @@ export default { checkbox: 'Checkbox', title3: 'Checkbox Group', title4: 'Inside a Cell', - title5: 'Configure the maximum amount of checked options' + title5: 'Maximum amount of checked options' } }, @@ -70,6 +70,7 @@ export default { 'c' ], result: ['a', 'b'], + result2: [], max: 2 }; } @@ -85,15 +86,13 @@ export default { .van-cell { .van-checkbox { margin: 0; - } + display: flex; + flex-direction: row-reverse; - .van-checkbox__input { - float: right; - position: static; - } - - span { - margin: 0; + &__label { + margin: 0; + flex: 1; + } } } } diff --git a/docs/markdown/en-US/checkbox.md b/docs/markdown/en-US/checkbox.md index 4ae5b3621..39c6c67ea 100644 --- a/docs/markdown/en-US/checkbox.md +++ b/docs/markdown/en-US/checkbox.md @@ -38,7 +38,7 @@ When Checkboxes are inside a CheckboxGroup, the checked checkboxes's name is an Checkbox {{ item }} @@ -57,41 +57,32 @@ export default { }; ``` +#### Maximum amount of checked options + +```html + + + Checkbox {{ item }} + + +``` + #### Inside a Cell ```html - + Checkbox {{ item }} ``` -#### Configure the maximum amount of checked options - -```html - - - - Checkbox {{ item }} - - - -``` - -``` -export default { - data() { - return { - list: ['a', 'b', 'c'], - result: ['a', 'b'], - max: 2 - }; - } -}; -``` ### Checkbox API @@ -106,7 +97,7 @@ export default { | Attribute | Description | Type | Default | Accepted Values | |-----------|-----------|-----------|-------------|-------------| | disabled | Disable all checkboxes | `Boolean` | `false` | - | -| max | the maximum amount of checked options | `Number` | `0`(Unlimited) | - | +| max | Maximum amount of checked options | `Number` | `0`(Unlimited) | - | ### Checkbox Event diff --git a/docs/markdown/zh-CN/checkbox.md b/docs/markdown/zh-CN/checkbox.md index add620c02..27cf5652a 100644 --- a/docs/markdown/zh-CN/checkbox.md +++ b/docs/markdown/zh-CN/checkbox.md @@ -40,7 +40,7 @@ export default { 复选框 {{ item }} @@ -59,6 +59,20 @@ export default { }; ``` +#### 设置最大可选数 + +```html + + + 复选框 {{ item }} + + +``` + #### 与 Cell 组件一起使用 此时你需要再引入`Cell`和`CellGroup`组件 @@ -66,40 +80,13 @@ export default { ```html - + 复选框 {{ item }} ``` -#### 设置最大可选数 - -此时你需要引入`CellGroup`组件,`Cell`组件非必须 - -```html - - - - 复选框 {{ item }} - - - -``` - -``` -export default { - data() { - return { - list: ['a', 'b', 'c'], - result: ['a', 'b'], - max: 2 - }; - } -}; -``` - - ### Checkbox API | 参数 | 说明 | 类型 | 默认值 | 可选值 | diff --git a/packages/checkbox/index.vue b/packages/checkbox/index.vue index afb85de2d..ba92c4cc0 100644 --- a/packages/checkbox/index.vue +++ b/packages/checkbox/index.vue @@ -1,28 +1,23 @@