From 90357ae3869873610944792195f587bf20455b31 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Thu, 9 Apr 2020 12:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DCheckBox=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/material/Checkbox.vue | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/renderer/components/material/Checkbox.vue b/src/renderer/components/material/Checkbox.vue index 902e2d71..968157a0 100644 --- a/src/renderer/components/material/Checkbox.vue +++ b/src/renderer/components/material/Checkbox.vue @@ -69,17 +69,25 @@ export default { } else { checked.splice(index, 1) } - } else if (typeof this.checked == 'boolean') { - let bool = this.bool - if (this.indeterminate) { - bool = true - this.$nextTick(() => { - this.bool = bool - }) - } - checked = bool } else { - checked = this.bool ? this.value : '' + let bool = this.bool + switch (typeof this.checked) { + case 'boolean': + if (this.indeterminate) { + bool = true + this.$nextTick(() => { + this.bool = bool + }) + } + checked = bool + break + case 'number': + checked = this.value + break + default: + checked = bool ? this.value : '' + break + } } this.$emit('input', checked) this.$emit('change', checked)