2015-01-15 45 views

回答

0

我觉得你应该自己通过小部件.widget的第二个参数()。不是一个字符串。这是我的测试。 http://jsfiddle.net/ho873kz4/

/**************************** 

Base Widget 

     Requires jQuery 
     Requires jQuery UI 

****************************/ 

(function($, undefined) { 
     'use_strict'; 



     /* 
     * A widget. 
     */ 
     $.widget('sb.baseApp', { 
       /* 
       * Widget Option 
       */ 
       options: {}, 



       /* 
       * Constructor, called once when first created 
       */ 
       _create: function() { 
        console.log('baseApp created'); 
       }, 

       /* 
       * Initialisation, called after _create and and on later widget calls. 
       */ 
       _init: function() { 
       }, 

       /* 
       * Destructor, cleanup when no longer needed. 
       */ 
       _destroy: function() { 
       } 
     }); 
} (jQuery)); 



/**************************** 

Textbox Widget 

     Requires jQuery 
     Requires jQuery UI 

****************************/ 

(function($, undefined) { 
     'use_strict'; 



     /* 
     * A widget 
     */ 
     $.widget('sb.textboxesApp', $.sb.baseApp, { 
       /* 
       * Widget Option 
       */ 
       options: {}, 



       /* 
       * Constructor, called once when first created 
       */ 
       _create: function() { 
        console.log('textboxesApp create'); 
        return this._super(); 
       }, 

       /* 
       * Initialisation, called after _create and and on later widget calls. 
       */ 
       _init: function() { 
       }, 

       /* 
       * Destructor, cleanup when no longer needed. 
       */ 
       _destroy: function() { 
       } 
     }); 
} (jQuery)); 

jQuery.sb.textboxesApp(); 
+0

非常感谢!这解决了我的问题;) – 2015-01-16 09:18:22

相关问题