From d4fb5d05b0eb68b354852e9c4e986ce17b6c9e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Tue, 14 Feb 2023 15:56:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20checkbox=20=E7=9A=84=20`ti?= =?UTF-8?q?tle`=20=E5=AF=B9=20`lay-text`=20=E5=B1=9E=E6=80=A7=E7=9A=84?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/form.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/form.js b/src/modules/form.js index db5c4f09..a9745eda 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -659,10 +659,9 @@ layui.define(['lay', 'layer', 'util'], function(exports){ checks.each(function(index, check){ var othis = $(this); var skin = othis.attr('lay-skin') || 'primary'; - var title = (function(title){ - // 向下兼容 lay-text 属性 - return title || othis.attr('lay-text') || ''; - })(check.title).replace(/\s/g, '').split('|'); + var title = $.trim(check.title || function(){ // 向下兼容 lay-text 属性 + return check.title = othis.attr('lay-text') || ''; + }()).split('|'); var disabled = this.disabled; if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格