当前位置: 移动技术网 > IT编程>脚本编程>extjs > javascript Ext JS 状态默认存储时间

javascript Ext JS 状态默认存储时间

2018年05月29日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:

ext.state.cookieprovider = function(config){
ext.state.cookieprovider.superclass.constructor.call(this);
this.path = "/";
this.expires = new date(new date().gettime()+(1000*60*60*24*7)); //7 days
this.domain = null;
this.secure = false;
ext.apply(this, config);
this.state = this.readcookies();
};
ext.state.cookieprovider = function(config){
ext.state.cookieprovider.superclass.constructor.call(this);
this.path = "/";
this.expires = new date(new date().gettime()+(1000*60*60*24*7)); //7 days
this.domain = null;
this.secure = false;
ext.apply(this, config);
this.state = this.readcookies();
};

我们可以通过设定expires的值来改变默认的存储时间,比如:
复制代码 代码如下:

this.expires: new date(new date().gettime()+(1000*60*60*24*365)), //一年
this.expires: new date(new date().gettime()+(1000*60*60*24*365)), //一年

或者我们可以在开始位置的ext.onready函数中加上以下的代码
复制代码 代码如下:

ext.state.manager.setprovider(
new ext.state.cookieprovider({
expires: new date(new date().gettime()+(1000*60*60*24*365)), //一年
}));

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网