From 26c238ebd70f3265eaa20673b6ef40f1a1976c3d Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 13 Jan 2022 10:27:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20switch?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E9=AB=98=E5=BA=A6=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/button/switch.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/case/button/switch.js b/src/case/button/switch.js index 1e9501661..2fcbf2c8f 100644 --- a/src/case/button/switch.js +++ b/src/case/button/switch.js @@ -3,6 +3,10 @@ */ BI.Switch = BI.inherit(BI.BasicButton, { + constants: { + CIRCLE_SIZE: 12 + }, + props: { extraCls: "bi-switch", height: 20, @@ -14,7 +18,8 @@ BI.Switch = BI.inherit(BI.BasicButton, { }, render: function () { - var self = this, o = this.options; + var self = this, o = this.options, c = this.constants; + var tgap = (o.height - c.CIRCLE_SIZE) / 2; return { type: "bi.absolute", ref: function () { @@ -27,14 +32,14 @@ BI.Switch = BI.inherit(BI.BasicButton, { }, width: 12, height: 12, - top: 4, + top: tgap, left: this.options.selected ? 28 : 4 }, { type: "bi.label", text: BI.i18nText("BI-Basic_Open"), cls: "content-tip", left: 8, - top: 2, + top: tgap - 2, invisible: !o.showTip, ref: function (ref) { self.openTip = ref; @@ -44,7 +49,7 @@ BI.Switch = BI.inherit(BI.BasicButton, { text: BI.i18nText("BI-Basic_Close"), cls: "content-tip", right: 8, - top: 2, + top: tgap - 2, invisible: !o.showTip, ref: function (ref) { self.closeTip = ref;