【问题标题】:pnotify: buttons don't workpnotify:按钮不起作用
【发布时间】:2014-10-09 16:37:02
【问题描述】:

我正在尝试使用 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 的模块

【问题讨论】:

    标签: javascript backbone.js requirejs pnotify


    【解决方案1】:

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

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

    【讨论】:

    • 谢谢你回答这个问题,我也在找这个答案
    猜你喜欢
    • 2018-09-07
    • 2011-12-02
    • 1970-01-01
    • 2018-11-08
    相关资源
    最近更新 更多