gpt4 book ai didi

javascript - 与 jquery 一起使用时,Pnotify 无法显示按钮

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:42:06 25 4
gpt4 key购买 nike

我将 pnotify 与 jquery 和 bootstrap3 结合使用,但按钮无法显示

我在应用程序头部包含了 pnotify.custom.min.csspnotify.custom.min.js 文件

这是显示它们的函数

<button 'onclick' => 'delete_category(' . $model->id .')'>Delete user</button>


function delete_category(id) {
PNotify.prototype.options.styling = "bootstrap3";
(new PNotify({
title: 'Confirmation',
text: 'This will delete the category?',
icon: 'glyphicon glyphicon-question-sign',
hide: false,
confirm: {
confirm: true
},
buttons: {
closer: true,
sticker: false
},
history: {
history: false
}
})).get().on('pnotify.confirm', function() {
alert('Ok, cool.');
}).on('pnotify.cancel', function() {
alert('Oh ok. Chicken, I see.');
});
}

上面显示了 pnotify 但没有显示按钮

enter image description here

最佳答案

问题不在于 Pnotify 按钮,而在于您配置按钮的路径,否则它们将不会显示。

Proof mentioned in the fiddle here

我假设您正在使用 require.js config 文件中设置按钮的路径

引用路径的正确方法是 pnotify.buttonspnotify.confirm

paths: {
pnotify: '<path-to-pnotify>/pnotify.core',
'pnotify.buttons': '<path-to-pnotify>/pnotify.buttons',
'pnotify.confirm': '<path-to-pnotify>/pnotify.confirm',
}

正确路径的规范很重要如引用的问题中所述 here

关于javascript - 与 jquery 一起使用时,Pnotify 无法显示按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41293171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com