Home  >  Article  >  Database  >  Sencha Touch 2 Global Variable

Sencha Touch 2 Global Variable

WBOY
WBOYOriginal
2016-06-07 15:24:481236browse

用了整整2个小时搜索资料,发现,定义变量如此简单,国内的文档基本上全是copy,没有一点技术含量; 我访问的data store url是带动弹参数的, 1、我定义一个变量,var params = ‘test’; 但是我其他的js 文件修改他的,一直没有反应;所有放弃了 2、 Ext.d

用了整整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') 

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


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn