基本用法:
Ext.util.Cookies.set(‘myCookie’,’myCookieValue’);
参数:
set( name, value, [expires], [path], [domain], [secure] )
注意expires参数:
expires : Date this cookie will expire. Default is browser session and please note that whatever value you pass here will be converted to GMT data
domani: 如果设置 abc.com 那 *.abc.com都可以使用。
secure:https时设置为true
Read more: http://jaspreetchahal.org/extjs-4-cookies/#ixzz3qywhUeUc
path:默认 ‘/’
设置日期的示例:
var now = new Date();
var expiry = new Date(now.getTime() + 365 * 24 * 60 * 60 * 1000);
Ext.util.Cookies.set('myCookie','myCookieValue',expiry);
获取值示例:
var myCookieVal = Ext.util.Cookies.get('myCookie');
console.log(myCookieVal);
清除cookie
Ext.util.Cookies.clear('myCookie');
文档:
http://docs.sencha.com/extjs/5.1.0/#!/api/Ext.util.Cookies-method-set