From a5971173689880950af80f72e57d94848f0c11f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 25 Sep 2017 01:23:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dlayer=E7=9A=84confirm?= =?UTF-8?q?=E5=92=8Cprompt=E5=8F=82=E6=95=B0=E5=BC=84=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/lib/layer/base.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/js/lib/layer/base.js b/js/lib/layer/base.js index a886f91..dfb87e8 100644 --- a/js/lib/layer/base.js +++ b/js/lib/layer/base.js @@ -103,17 +103,19 @@ define(['yua', 'lib/drag/main', 'css!./skin/def'], function(yua){ conf.content = msg return __layer.open(conf) }, - confirm: function(msg, conf){ - if(typeof conf === 'function'){ - conf = {yes: conf} - }else if(typeof conf === 'object'){ - conf = conf - }else{ - conf = {} + confirm: function(msg, yescb, nocb){ + var conf = {} + if(typeof yescb === 'function'){ + conf = {yes: yescb} + }else if(typeof yescb === 'object'){ + conf = yescb } conf.type = 2 conf.icon = 0 conf.content = msg + if(typeof nocb === 'function'){ + conf.no = nocb + } return __layer.open(conf) }, msg: function(msg, conf){ @@ -181,7 +183,7 @@ define(['yua', 'lib/drag/main', 'css!./skin/def'], function(yua){ conf.menubar = false; return __layer.open(conf) }, - prompt: function(msg, yescb, nocb){ + prompt: function(msg, yescb){ if(typeof yescb !== 'function'){ return console.error('argument [callback] requires a function, but ' + (typeof yescb) + ' given') } @@ -197,9 +199,6 @@ define(['yua', 'lib/drag/main', 'css!./skin/def'], function(yua){ yescb(id, yua.vmodels[id].prompt) } } - if(typeof nocb === 'function'){ - conf.no = nocb - } return __layer.open(conf) }, use: function(skin, callback){