Skip to content

Commit

Permalink
[improvement] Checkbox: optimize performance (youzan#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Dec 11, 2018
1 parent 97476fe commit b45b601
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/checkbox-group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ VantComponent({
},

props: {
max: Number,
value: Array,
disabled: Boolean,
max: Number
disabled: Boolean
},

watch: {
Expand Down
10 changes: 0 additions & 10 deletions packages/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
emitChange(value) {
const parent = this.getRelationNodes('../checkbox-group/index')[0];
Expand Down
2 changes: 1 addition & 1 deletion packages/checkbox/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
wx:else
name="success"
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-style="line-height: 20px;"
/>
Expand Down

0 comments on commit b45b601

Please sign in to comment.