Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 链接2模态_Javascript_Promise_Sweetalert_Finally_Sweetalert2 - Fatal编程技术网

Javascript 链接2模态

Javascript 链接2模态,javascript,promise,sweetalert,finally,sweetalert2,Javascript,Promise,Sweetalert,Finally,Sweetalert2,我正在使用sweetalert2验证电子邮件地址,但我希望它随后显示输入名称的文本输入。我知道它是链式情态动词,但我无法从页面上给出的例子中找出我该怎么做 var cloud_email = $('.cloud_email').text(); var user_name = $('.user_name').text();; swal.setDefaults({ confirmButtonText: 'Next →', showCancelButton: true,

我正在使用sweetalert2验证电子邮件地址,但我希望它随后显示输入名称的文本输入。我知道它是链式情态动词,但我无法从页面上给出的例子中找出我该怎么做

var cloud_email = $('.cloud_email').text();
var user_name = $('.user_name').text();;
swal.setDefaults({
  confirmButtonText: 'Next →',
  showCancelButton: true,
  animation: false
});

var steps = [
  {
    //ask for and validate email here
    type: 'question',
    title: 'Please enter email address',
    input: 'email',
    inputValue: cloud_email  
  },
  {
    //ask for and validate text input here
    type: 'question',
    title: 'Please enter user name',
    input: 'text',
    inputValue: user_name
  }
];

swal.queue(steps).then(function(email, name) {
  swal({
    type: 'success',
    html: 'Email successfully sent to: ' + name + ': '+ email
  });
}).finally(function() {
  swal.resetDefaults();
  //ajax to process values passed
})
我的尝试返回以下错误:

swal.queue(...).then(...).finally is not a function
要使用
finally()



另外,我刚刚添加了
Promise.prototype的链接。最后,
polyfill添加到示例页面: