mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[new feature] Checkbox: add icon-size prop
This commit is contained in:
parent
1d658a9338
commit
d46b6e4fde
@ -64,6 +64,10 @@
|
|||||||
|
|
||||||
- 新增`loading-type`属性
|
- 新增`loading-type`属性
|
||||||
|
|
||||||
|
### Checkbox
|
||||||
|
|
||||||
|
- 新增`icon-size`属性
|
||||||
|
|
||||||
### Field
|
### Field
|
||||||
|
|
||||||
- 新增`label-class`属性
|
- 新增`label-class`属性
|
||||||
|
@ -142,6 +142,7 @@ export default {
|
|||||||
| shape | Can be set to `square` | `String` | `round` |
|
| shape | Can be set to `square` | `String` | `round` |
|
||||||
| v-model | Check status | `Boolean` | `false` |
|
| v-model | Check status | `Boolean` | `false` |
|
||||||
| disabled | Diable checkbox | `Boolean` | `false` |
|
| disabled | Diable checkbox | `Boolean` | `false` |
|
||||||
|
| icon-size | Icon size | `String | Number` | `20px` |
|
||||||
| 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` |
|
| label-position | Can be set to `left` | `String` | `right` |
|
||||||
| checked-color | Checked color | `String` | `#1989fa` | - |
|
| checked-color | Checked color | `String` | `#1989fa` | - |
|
||||||
|
@ -8,19 +8,21 @@
|
|||||||
&__label {
|
&__label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
line-height: @checkbox-size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__icon {
|
&__icon {
|
||||||
height: @checkbox-size;
|
height: 1em;
|
||||||
|
line-height: 1em;
|
||||||
|
font-size: @checkbox-size;
|
||||||
|
|
||||||
.van-icon {
|
.van-icon {
|
||||||
font-size: 14px;
|
display: block;
|
||||||
|
width: 1.25em;
|
||||||
|
height: 1.25em;
|
||||||
|
font-size: .8em;
|
||||||
color: transparent;
|
color: transparent;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
width: @checkbox-size;
|
|
||||||
height: @checkbox-size;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid @checkbox-border-color;
|
border: 1px solid @checkbox-border-color;
|
||||||
transition: @checkbox-transition-duration;
|
transition: @checkbox-transition-duration;
|
||||||
@ -56,6 +58,7 @@
|
|||||||
|
|
||||||
&__label {
|
&__label {
|
||||||
color: @checkbox-label-color;
|
color: @checkbox-label-color;
|
||||||
|
line-height: @checkbox-size;
|
||||||
margin-left: @checkbox-label-margin;
|
margin-left: @checkbox-label-margin;
|
||||||
|
|
||||||
&--left {
|
&--left {
|
||||||
|
@ -145,6 +145,7 @@ export default {
|
|||||||
| shape | 形状,可选值为 `square` | `String` | `round` | - |
|
| shape | 形状,可选值为 `square` | `String` | `round` | - |
|
||||||
| v-model | 是否为选中状态 | `Boolean` | `false` | - |
|
| v-model | 是否为选中状态 | `Boolean` | `false` | - |
|
||||||
| disabled | 是否禁用复选框 | `Boolean` | `false` | - |
|
| disabled | 是否禁用复选框 | `Boolean` | `false` | - |
|
||||||
|
| icon-size | 图标大小,默认单位为`px` | `String | Number` | `20px` | 2.0.0 |
|
||||||
| label-disabled | 是否禁用复选框文本点击 | `Boolean` | `false` | - |
|
| label-disabled | 是否禁用复选框文本点击 | `Boolean` | `false` | - |
|
||||||
| label-position | 文本位置,可选值为 `left` | `String` | `right` | 1.1.11 |
|
| label-position | 文本位置,可选值为 `left` | `String` | `right` | 1.1.11 |
|
||||||
| checked-color | 选中状态颜色 | `String` | `#1989fa` | 1.4.3 |
|
| checked-color | 选中状态颜色 | `String` | `#1989fa` | 1.4.3 |
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
import { ChildrenMixin } from './relation';
|
import { ChildrenMixin } from './relation';
|
||||||
|
import { suffixPx } from '../utils';
|
||||||
|
|
||||||
export const CheckboxMixin = (parent, bem) => ({
|
export const CheckboxMixin = (parent, bem) => ({
|
||||||
mixins: [ChildrenMixin(parent)],
|
mixins: [ChildrenMixin(parent)],
|
||||||
@ -10,6 +11,7 @@ export const CheckboxMixin = (parent, bem) => ({
|
|||||||
props: {
|
props: {
|
||||||
name: null,
|
name: null,
|
||||||
value: null,
|
value: null,
|
||||||
|
iconSize: [String, Number],
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
checkedColor: String,
|
checkedColor: String,
|
||||||
labelPosition: String,
|
labelPosition: String,
|
||||||
@ -61,6 +63,7 @@ export const CheckboxMixin = (parent, bem) => ({
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class={bem('icon', [this.shape, { disabled: this.isDisabled, checked }])}
|
class={bem('icon', [this.shape, { disabled: this.isDisabled, checked }])}
|
||||||
|
style={{ fontSize: suffixPx(this.iconSize) }}
|
||||||
onClick={this.onClickIcon}
|
onClick={this.onClickIcon}
|
||||||
>
|
>
|
||||||
{CheckIcon}
|
{CheckIcon}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user