【问题标题】:SweetAlert2 doesn't seem to work for me . What have i done wrong?SweetAlert2 似乎对我不起作用。我做错了什么?
【发布时间】:2021-05-21 11:41:12
【问题描述】:

Here is the link to a simple source code example 。我不知道我做错了什么,当我按下按钮时我似乎得到了回复,我可以证明它是因为通知代码。

这是一个最小的可重现代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="https://unpkg.com/notie/dist/notie.min.css"> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.16.6/sweetalert2.css">

</head>
<body>

    <div class="container">
        <div class="row">
            <div class="col">
                <div><input type="submit" id="swale" class="btn btn-outline-danger" value="Make Registration"></div>
            </div>
        </div>
    </div>


    <script src="https://unpkg.com/notie"></script>
    <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>



    <script>
        document.getElementById("swale").addEventListener("click", function(){
            notify("This is a success message", "success")
            notifyModal()
        })

        function notify(msg,msgType){
            notie.alert({
            type: msgType,
            text: msg,
            })
        }

        function notifyModal(){
            swal.fire({
                title: "title",
                html: "<em> hello, world </em>",
                icon: "success",
                confirmButtonText: "wsd"
            })
        }
    </script>
</body>
</html>

【问题讨论】:

标签: javascript html css notifications sweetalert2


【解决方案1】:

您必须在脑海中调用样式 sweetalert2

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/10.16.6/sweetalert2.css">

【讨论】:

  • 我确实尝试过,但由于某些未知原因它仍然无法正常工作。
猜你喜欢
  • 2012-07-30
  • 2018-03-29
  • 2010-11-26
  • 1970-01-01
  • 1970-01-01
  • 2012-06-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多