如何在sencha / ext JS中设置/获取配置变量? [英] How to set/get config variable in sencha/ext JS ?

查看:113
本文介绍了如何在sencha / ext JS中设置/获取配置变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想得到配置变量,我想在我的应用程序中获取狼吞虎咽,如何做到这一点。



我想在app.js中定义它

 //这里我要定义它
Ext.application({
name:'vDemo' ,
控制器:['App'],
启动:function(){
this.getController('App');
}
});



我想使用这个变量来维护用户状态。就像我们在ASP.NET中使用session一样。



我是Ext JS编程的新手。

请给出一个想法来维护用户状态Ext JS Application。



我尝试过:



我是在My Ext JS应用程序中维护用户状态

解决方案

您需要将这些值保存在应用程序中包含的全局文件中。确保正确命名以避免冲突。

类似于 -

 MyApp = {
config:{
property1:' value1'
property2:' value2'
}
}



然后你可以访问这些值,如$

 myProperty1 = MyApp.config.property1; 





希望,它有帮助:)



参考: javascript - 如何阅读值来自ExtJs中的属性文件 - Stack Overflow [ ^ ]


hello,
I want to get config variable which i want to get gobble access in my app, How can do it.

I want to define it in app.js

//Here I want to define it
Ext.application({
    name: 'vDemo',
    controllers: ['App'],
    launch: function () {
        this.getController('App');
    }
});


I want to use this variable for maintain user state. like we use session in ASP.NET.

I am new in Ext JS programming.
Please give an Idea to maintain user state in Ext JS Application.

What I have tried:

I am going to maintain user state in My Ext JS application

解决方案

You need to keep those values in a global file which gets included in the app. Make sure to name it correctly to avoid conflict.
Something like-

MyApp = {
    config:{
            property1:'value1',
            property2:'value2'
          }
}


Then you can access these values like-

myProperty1 = MyApp.config.property1;



Hope, it helps :)

Reference: javascript - How to read values from properties file in ExtJs - Stack Overflow[^]


这篇关于如何在sencha / ext JS中设置/获取配置变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆