fix select bug

This commit is contained in:
sentsin 2017-03-01 11:52:55 +08:00
parent 5903266d54
commit 756252ccf0
3 changed files with 11 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -153,7 +153,7 @@ layui.define('layer', function(exports){
var othis = $(this)
,text = othis.text()
,not = text.indexOf(value) === -1;
if(value === '' || (keyup ? not : value !== text)) num++;
if(value === '' || not) num++;
keyup && othis[not ? 'addClass' : 'removeClass'](HIDE);
});
var none = num === dds.length;
@ -179,14 +179,19 @@ layui.define('layer', function(exports){
}
}, true);
if(value === ''){
dl.find('.'+NONE).remove();
}
};
if(isSearch){
input.on('keyup', search).on('blur', function(e){
thatInput = input;
initValue = dl.find('.'+THIS).html();
if(!initValue){
input.val('');
}
notOption(input.val(), function(none){
if(none && !initValue){
input.val('');
}
});
});
}