修复 select 中 option 内容出现双引号时的异常显示问题

pull/1104/head
贤心 2022-07-29 10:24:21 +08:00
parent e259a6f4fc
commit cfd6f0cb5f
1 changed files with 120 additions and 120 deletions

View File

@ -1,20 +1,20 @@
/** /**
* form 表单组件 * form 表单组件
* MIT Licensed
*/ */
layui.define('layer', function(exports){ layui.define(['layer', 'util'], function(exports){
"use strict"; "use strict";
var $ = layui.$ var $ = layui.$;
,layer = layui.layer var layer = layui.layer;
,hint = layui.hint() var util = layui.util;
,device = layui.device() var hint = layui.hint();
var device = layui.device();
,MOD_NAME = 'form', ELEM = '.layui-form', THIS = 'layui-this' var MOD_NAME = 'form', ELEM = '.layui-form', THIS = 'layui-this';
,SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'layui-disabled' var SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'layui-disabled';
,Form = function(){ var Form = function(){
this.config = { this.config = {
verify: { verify: {
required: [ required: [
@ -357,7 +357,7 @@ layui.define('layer', function(exports){
var text = othis.text(); var text = othis.text();
// 是否区分大小写 // 是否区分大小写
if(laySearch !== 'exact'){ if(laySearch !== 'cs'){
text = text.toLowerCase(); text = text.toLowerCase();
value = value.toLowerCase(); value = value.toLowerCase();
} }
@ -477,8 +477,8 @@ layui.define('layer', function(exports){
var reElem = $(['<div class="'+ (isSearch ? '' : 'layui-unselect ') + CLASS var reElem = $(['<div class="'+ (isSearch ? '' : 'layui-unselect ') + CLASS
,(disabled ? ' layui-select-disabled' : '') +'">' ,(disabled ? ' layui-select-disabled' : '') +'">'
,'<div class="'+ TITLE +'">' ,'<div class="'+ TITLE +'">'
,('<input type="text" placeholder="'+ $.trim(placeholder) +'" ' ,('<input type="text" placeholder="'+ util.escape($.trim(placeholder)) +'" '
+('value="'+ $.trim(value ? selected.html() : '') +'"') //默认值 +('value="'+ util.escape($.trim(value ? selected.html() : '')) +'"') // 默认值
+((!disabled && isSearch) ? '' : ' readonly') // 是否开启搜索 +((!disabled && isSearch) ? '' : ' readonly') // 是否开启搜索
+' class="layui-input' +' class="layui-input'
+(isSearch ? '' : ' layui-unselect') +(isSearch ? '' : ' layui-unselect')
@ -493,7 +493,7 @@ layui.define('layer', function(exports){
} else if(item.tagName.toLowerCase() === 'optgroup'){ } else if(item.tagName.toLowerCase() === 'optgroup'){
arr.push('<dt>'+ item.label +'</dt>'); arr.push('<dt>'+ item.label +'</dt>');
} else { } else {
arr.push('<dd lay-value="'+ item.value +'" class="'+ (value === item.value ? THIS : '') + (item.disabled ? (' '+DISABLED) : '') +'">'+ $.trim(item.innerHTML) +'</dd>'); arr.push('<dd lay-value="'+ util.escape(item.value) +'" class="'+ (value === item.value ? THIS : '') + (item.disabled ? (' '+DISABLED) : '') +'">'+ $.trim(item.innerHTML) +'</dd>');
} }
}); });
arr.length === 0 && arr.push('<dd lay-value="" class="'+ DISABLED +'">没有选项</dd>'); arr.length === 0 && arr.push('<dd lay-value="" class="'+ DISABLED +'">没有选项</dd>');