From 477a0add41a1c04e374b578f9cf0b7c4b029d024 Mon Sep 17 00:00:00 2001 From: meihangbo Date: Wed, 3 May 2017 18:12:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20prompt=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=BC=BA=E8=A1=8C=E8=AE=BE=E7=BD=AE=E9=9D=9Einput,val?= =?UTF-8?q?ue.length=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正 prompt 设置强行设置非input,value.length报错 --- src/layer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layer.js b/src/layer.js index 0cc4e0d8..0b128cb9 100644 --- a/src/layer.js +++ b/src/layer.js @@ -972,7 +972,7 @@ layer.prompt = function(options, yes){ var value = prompt.val(); if(value === ''){ prompt.focus(); - } else if(value.length > (options.maxlength||500)) { + } else if(value&&value.length > (options.maxlength||500)) { layer.tips('最多输入'+ (options.maxlength || 500) +'个字数', prompt, {tips: 1}); } else { yes && yes(value, index, prompt);