layer.prompt的文本框添加placeholder

pull/1136/head
wanbo.ge 2022-09-22 11:44:36 +08:00
parent 016ea2085a
commit 3cda26d416
1 changed files with 6 additions and 3 deletions

View File

@ -1176,7 +1176,7 @@ var cache = layer.cache||{}, skin = function(type){
//仿系统prompt //仿系统prompt
layer.prompt = function(options, yes){ layer.prompt = function(options, yes){
var style = ''; var style = '', placeholder = '';
options = options || {}; options = options || {};
if(typeof options === 'function') yes = options; if(typeof options === 'function') yes = options;
@ -1186,8 +1186,11 @@ layer.prompt = function(options, yes){
style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"'; style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
delete options.area; delete options.area;
} }
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'></textarea>' : function(){ if (options.placeholder) {
return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input">'; placeholder = ' placeholder="' + options.placeholder + '"';
}
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style + placeholder + '></textarea>' : function () {
return '<input type="' + (options.formType == 1 ? 'password' : 'text') + '" class="layui-layer-input"' + placeholder + '>';
}(); }();
var success = options.success; var success = options.success;