jQuery插件机制

代码如下:

$.extend({toast: toast});
    $.extend({alert: alert});
    $.extend({confirm: confirm});
    
    
    $.extend({modal: modal}); // $.modal($('.test'), show) 方式
    $.fn.modal = function(show){  // $('.test').modal(show) 方式
        modal(this, show);
    };

有两种方式增加插件

原文地址:https://www.cnblogs.com/hool/p/11606240.html