mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[improvement] Checkbox: optimize performance (#1057)
This commit is contained in:
parent
97476fec76
commit
b45b601b69
@ -16,9 +16,9 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
max: Number,
|
||||||
value: Array,
|
value: Array,
|
||||||
disabled: Boolean,
|
disabled: Boolean
|
||||||
max: Number
|
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -23,16 +23,6 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
|
||||||
iconStyle(): string {
|
|
||||||
const { value, disabled, checkedColor } = this.data;
|
|
||||||
if (checkedColor && value && !disabled) {
|
|
||||||
return `border-color: ${checkedColor}; background-color: ${checkedColor}`;
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
emitChange(value) {
|
emitChange(value) {
|
||||||
const parent = this.getRelationNodes('../checkbox-group/index')[0];
|
const parent = this.getRelationNodes('../checkbox-group/index')[0];
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
wx:else
|
wx:else
|
||||||
name="success"
|
name="success"
|
||||||
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
|
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
|
||||||
style="{{ iconStyle }}"
|
style="{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
|
||||||
custom-class="icon-class"
|
custom-class="icon-class"
|
||||||
custom-style="line-height: 20px;"
|
custom-style="line-height: 20px;"
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user