首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sweetalert2 javascript (progresStep)

Sweetalert2 javascript (progresStep)
EN

Stack Overflow用户
提问于 2018-11-03 03:15:03
回答 1查看 876关注 0票数 0

所以,我对sweetalert2有一些问题(我是新来的)。

我有这个脚本,但我不知道如何使用进度步骤(参见下面的.gif )

代码语言:javascript
复制
<a href="javascript:void(0)" onclick="givepptoplayer()">Set Premium Points</a></li>

<script>
  function givepptoplayer() {
    swal({
       title: 'Change User Premium Points <?php echo $data->name ?>',
       input: 'number',
       showCancelButton: false,
       confirmButtonText: 'edit',
       showLoaderOnConfirm: true,
       confirmButtonClass: 'btn btn-success',
       cancelButtonClass: 'btn btn-danger m-l-10',
       allowOutsideClick: false,
       inputValue: '',
     }).then(function (result) {           
       $.post('<?php echo config::$_PAGE_URL ?>api/finishthis', { 'userid' : '<?php echo $data->id ?>', 'changePP': result.value}, function(result) 
         { 
           swal({
             type: 'success',
             title: 'Succes!',
             html: result
           });
         });
     });                                    
   }
</script>

我想在什么时候创建一个类似下面这样的progressStep:https://gyazo.com/41f65065108e3937e3afc2a3064ee028

你们能给我举个例子吗?

EN

回答 1

Stack Overflow用户

发布于 2018-11-04 00:32:32

https://sweetalert2.github.io/#chaining-modals上有一个用相关代码链接模态的例子。基本上代码是:

代码语言:javascript
复制
swal.mixin({
  input: 'text',
  confirmButtonText: 'Next &rarr;',
  showCancelButton: true,
  progressSteps: ['1', '2', '3']
}).queue([
  {
    title: 'Question 1',
    text: 'Chaining swal2 modals is easy'
  },
  'Question 2',
  'Question 3'
]).then((result) => {
  if (result.value) {
    swal({
      title: 'All done!',
      html:
        'Your answers: <pre><code>' +
          JSON.stringify(result.value) +
        '</code></pre>',
      confirmButtonText: 'Lovely!'
    })
  }
})
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53124597

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档