From 3cda26d416613454eced724a5adca99c13a809c6 Mon Sep 17 00:00:00 2001 From: "wanbo.ge" Date: Thu, 22 Sep 2022 11:44:36 +0800 Subject: [PATCH] =?UTF-8?q?layer.prompt=E7=9A=84=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=A1=86=E6=B7=BB=E5=8A=A0placeholder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/layer.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/layer.js b/src/modules/layer.js index 141c1138..2f3fa2e8 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -1176,7 +1176,7 @@ var cache = layer.cache||{}, skin = function(type){ //仿系统prompt layer.prompt = function(options, yes){ - var style = ''; + var style = '', placeholder = ''; options = options || {}; if(typeof options === 'function') yes = options; @@ -1186,8 +1186,11 @@ layer.prompt = function(options, yes){ style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"'; delete options.area; } - var prompt, content = options.formType == 2 ? '' : function(){ - return ''; + if (options.placeholder) { + placeholder = ' placeholder="' + options.placeholder + '"'; + } + var prompt, content = options.formType == 2 ? '' : function () { + return ''; }(); var success = options.success;