我正在使用 angularjs、requirejs、bootstrap3 + fontawesome。PNotify 核心效果很好;但是每次我使用按钮并确认时,按钮都不会出现。
我使用 bower 安装了 PNotify,并在我的应用程序库中包含了所有模块(pnotify.core.js 及其所有 js 模块)。
这就是我配置 requireJS 的方式:
require.config({
baseUrl: '/assets/angular',
paths: {
pnotify: 'libs/pnotify/pnotify.core',
// pnotifyButtons: 'libs/pnotify/pnotify.buttons', --> I tried to include the modules but it had no effect
// pnotifyConfirm: 'libs/pnotify/pnotify.confirm', --> I tried to include the modules but it had no effect
}
});
这就是我所说的 Pnotify
$scope.deleteData = function() {
var confirmNotice = new Pnotify({
text: 'Are you sure to delete this data?',
type: 'notice',
icon: false,
buttons: {
closer: false,
sticker: false
},
confirm: {confirm:true}
});
confirmNotice.get().on('pnotify.confirm', function() {
alert('Ok, cool.');
});
confirmNotice.get().on('pnotify.cancel', function() {
alert('Oh ok. Chicken, I see.');
});
};
它只是返回了一个没有任何按钮的“普通”通知
PS:
我已在我的应用程序初始化部分包含此代码:PNotify.prototype.options.styling = "fontawesome"; 我尝试从其站点(pnotify.custom.min.js)下载 PNotify,它返回了相同的结果(按钮未显示)