【问题标题】:SweetAlert html option not workingSweetAlert html 选项不起作用
【发布时间】:2022-01-20 16:42:34
【问题描述】:

带有 html 选项的甜蜜警报不起作用你们能解释我解决这个问题吗?否则我想将模板显式绑定到甜蜜警报。

    swal({
        title: "Are you sure?",
        text: '<b>Hiiii</b>' ,
        type: "info",
        showCancelButton: true,
        confirmButtonColor: "#F44336",
        confirmButtonText: "Yes, accept it!",
        closeOnConfirm: true
        html:true
    }, function() {
        $scope.onComment(record);
    });

你们能帮我解决这个甜蜜的警报问题吗?

【问题讨论】:

  • 请添加一些代码,到目前为止您尝试了什么?
  • 正如@lin 所说,提供代码。你可以使用 AngularJS SweetAlert 包装器github.com/oitozero/ngSweetAlert
  • swal({ title: "Are you sure?", text: 'Hiiii' , type: "info", showCancelButton: true, confirmButtonColor: "#F44336", confirmButtonText: "是的,接受它!", closeOnConfirm: true html:true }, function() { $scope.onComment(record); });

标签: javascript angularjs sweetalert


【解决方案1】:

正如医生所说:

html is no longer used. Instead use the content object.

(https://sweetalert.js.org/guides/)

尝试:

swal({
  content: "input",
});

【讨论】:

  • 我是通过凉亭安装的
  • 仔细检查您包含的路径(是 dist 文件夹吗?)
  • swall 工作正常,但使用 html true 选项不起作用。
  • 其实我想在swall中显示动态html表格。
  • 您使用的是内联模板还是网址?
【解决方案2】:

我在新版本中发现了如何做到这一点。 请参阅以下信息。

sweet-alert display HTML code in text

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-28
    • 1970-01-01
    • 2019-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多