修复 checkbox 的 `title` 属性值出现 `|` 内容时无法显示的问题

pull/1229/head
贤心 2023-04-23 15:32:05 +08:00
parent f015314ac4
commit bccda5c5ab
1 changed files with 4 additions and 1 deletions

View File

@ -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;