1

我遇到了无法使用 noty 插件显示通知的问题。我在 ASP.net Web 应用程序中包含了这个插件。

_Layout.cshtml

<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
<link href="~/lib/bootstrap-table/dist/bootstrap-table.css" rel="stylesheet" /> 
<link href="~/css/site.css" rel="stylesheet" />
<link rel="stylesheet" href="~/css/sticky_footer.css" />
<link href="~/lib/noty/lib/noty.css" rel="stylesheet" />

<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
<script src="~/lib/jquery-validation/dist/additional-methods.js"></script>
<script src="~/lib/js-cookie/src/js.cookie.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/lib/bootstrap-table/dist/bootstrap-table.js"></script>
<script src="~/lib/noty/lib/noty.js"></script>
<script src="~/lib/moment/min/moment.min.js"></script>
<script src="~/lib/he/he.js"></script>
<script src="~/lib/bootstrap-table-contextmenu/dist/bootstrap-table-contextmenu.min.js"></script>

创建.cshtml

 $updateSessionSynopsisHandler.done(function (data, textStatus, jqXHR) {
            noty({
                text: data.message, type: 'success',
                layout: 'center'
            });

        });

错误 在此处输入图像描述

4

1 回答 1

2

正如Noty 文档中所写,我认为 Noty 是一个构造函数。它应该在你想使用它之前被实例化。尝试这个

$updateSessionSynopsisHandler.done(function (data, textStatus, jqXHR) {
        new Noty({
            text: data.message, type: 'success',
            layout: 'center'
        }).show();
    });
于 2017-12-19T07:40:53.210 回答