bug fixes
This commit is contained in:
parent
97d7a5f0bc
commit
95753101db
2
dist/lay/modules/form.js
vendored
2
dist/lay/modules/form.js
vendored
File diff suppressed because one or more lines are too long
2
dist/layui.all.js
vendored
2
dist/layui.all.js
vendored
File diff suppressed because one or more lines are too long
@ -101,7 +101,7 @@ body{padding: 10px;}
|
||||
<label class="layui-form-label">搜索选择框</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="interest-search" lay-filter="interest-search" lay-search>
|
||||
<option value=""></option>
|
||||
<option value="">请搜索</option>
|
||||
<option value="写作">写作</option>
|
||||
<option value="阅读" disabled>阅读</option>
|
||||
<option value="游戏" disabled>游戏</option>
|
||||
|
@ -167,9 +167,18 @@ layui.define('layer', function(exports){
|
||||
|
||||
notOption(input.val(), function(none){
|
||||
var selectedIndex = select[0].selectedIndex;
|
||||
|
||||
//未查询到相关值
|
||||
if(none){
|
||||
initValue = $(select[0].options[selectedIndex]).html(); //重新获得初始选中值
|
||||
initValue || input.val(''); //none && !initValue
|
||||
|
||||
//如果是第一项,且文本值等于 placeholder,则清空初始值
|
||||
if(selectedIndex === 0 && initValue === input.attr('placeholder')){
|
||||
initValue = '';
|
||||
};
|
||||
|
||||
//如果有选中值,则将输入框纠正为该值。否则清空输入框
|
||||
input.val(initValue || '');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -328,8 +337,15 @@ layui.define('layer', function(exports){
|
||||
if(isSearch){
|
||||
input.on('keyup', search).on('blur', function(e){
|
||||
var selectedIndex = select[0].selectedIndex;
|
||||
|
||||
thatInput = input; //当前的 select 中的 input 元素
|
||||
initValue = $(select[0].options[selectedIndex]).html(); //重新获得初始选中值
|
||||
|
||||
//如果是第一项,且文本值等于 placeholder,则清空初始值
|
||||
if(selectedIndex === 0 && initValue === input.attr('placeholder')){
|
||||
initValue = '';
|
||||
};
|
||||
|
||||
setTimeout(function(){
|
||||
notOption(input.val(), function(none){
|
||||
initValue || input.val(''); //none && !initValue
|
||||
|
Loading…
Reference in New Issue
Block a user