3

我正在尝试使用 Pnotify 的按钮,但我无法让它们工作。问题是我将 Pnotify 与 requiredJS 和 Bower 一起使用(在骨干网内).. 我尝试了很多方法..

Pnotify 文档对此问题有评论:(https://github.com/sciactive/pnotify#using-pnotify-with-requirejs)这是示例:

requirejs(['pnotify', 'pnotify.nonblock', 'pnotify.desktop'], function(PNotify){
    PNotify.desktop.permission();
    new PNotify({
        title: 'Desktop Notice',
        text: 'If you\'ve given me permission, I\'ll appear as a desktop notification. If you haven\'t, I\'ll still appear as a regular PNotify notice.',
        desktop: {
            desktop: true
        },
        nonblock: {
            nonblock: true
        }
    });
});

该示例对我有用,因此我根据需要对其进行了一些修改:

require(['pnotify', 'pnotify.buttons', 'pnotify.nonblock'], function(PNotify){
            new PNotify({
                title: title ,
                text: msg,
                type: classes,
                delay: delay,
                animation: 'fade',
                opacity: .9,
                nonblock: {
                    nonblock: true,
                    nonblock_opacity: .2
                }
            });
 });

这样非阻塞消息是否可以正常工作并且桌面通知也可以(如果需要)但没有出现按钮......有人有类似的问题吗?任何的想法?找到解决方案会很棒。谢谢!

注意:我已经安装了所有 pnotify 的模块

4

1 回答 1

3

似乎 nonblock 和 Buttons 模块不能很好地配合使用。github的项目有问题:https ://github.com/sciactive/pnotify/issues/145

因此,当移除非块模块时,按钮可以正常工作。

于 2014-08-20T20:52:12.173 回答