Sencha Touch 2 Global Variable

用了整整2個小時搜索資料,發現,定義變量如此簡單,國內的文檔基本上全是copy,沒有一點技術含量;

我訪問的data store url是帶動彈參數的,

1、我定義一個變量,var params = ‘test’;

      但是我其他的js 文件修改他的值,一直沒有反應;所有放棄了

2、Ext.define MyApp.app.Config 

      在application 裏面requires['MyApp.app.Config']

   MyApp.app.Config.getParams();

   一直沒有出現我的結果,果斷放棄

3、在組建裏面定義:

   var_params: 'test';

     setParams : function(arg){

     this.var_params = arg

     }

     getParams: function(){

          retun  this.var_params 

     }

 這種方式也行不行,鬱悶的好久好久l

4、終於在老外的資料發現了這樣的方法:

      Set it as: localStorage.setItem('currentUserId', userID) 

      Get it as: localStorage.getItem('currentUserId') 

       太爽了,好棒的方法,調用成功!


發佈了59 篇原創文章 · 獲贊 4 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章