4

我从Pines Notify下载了 pnotify jquery 插件

简单地说,它告诉我添加所需的 js 和 css 文件,并且在准备好文档时,以下应该可以工作!

$(document).ready(function() {
    $.pnotify({
        type: 'error',
        title: 'Errors found in form',
        text: 'Please check all form data, some items were invalid.',
        opacity: 0.95,
        hide:false,
        history: false,
        sticker: false
    });    
});

但它只是不断给我错误

未捕获的类型错误:对象函数 (e,t){return new v.fn.init(e,t,n)} 没有方法“pnotify”

最愚蠢的是,即时视觉 VS 2012 和在开发环境中它向我展示了 pnotify 作为 '$' 作为智能感知的功能!

我可能做错了什么?

4

1 回答 1

0

with PNotify2.01, you can use it with reguirejs

main.js:

requirejs.config({
   paths: {
      pnotify: "/Static/plugins/pnotify/pnotify.custom.min"
   }
});

Notify.js

define(['pnotify'], function () {
  return {
     SimpleNotice: function () {
        return new PNotify('Check me out! I\'m a notice.');
     }
  };
});

I copy this from my production code (Durandal framework)

于 2014-05-25T21:52:18.457 回答