From bccda5c5ab0220bd3ab4ca89a9a715f2974a850f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Sun, 23 Apr 2023 15:32:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20checkbox=20=E7=9A=84=20`ti?= =?UTF-8?q?tle`=20=E5=B1=9E=E6=80=A7=E5=80=BC=E5=87=BA=E7=8E=B0=20`|`=20?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=97=B6=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/form.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/form.js b/src/modules/form.js index e0cc3938..c8b2aa5c 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -672,9 +672,12 @@ layui.define(['lay', 'layer', 'util'], function(exports){ var skin = othis.attr('lay-skin') || 'primary'; var title = $.trim(check.title || function(){ // 向下兼容 lay-text 属性 return check.title = othis.attr('lay-text') || ''; - }()).split('|'); + }()); var disabled = this.disabled; + // 若为开关,则对 title 进行分隔解析 + title = skin === 'switch' ? title.split('|') : [title]; + if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格 var RE_CLASS = CLASS[skin] || CLASS.checkbox;