js-cookie对cookie的操作

1、安装js-cookie
2、import Cookies from ‘js-cookie‘
设置cookie
private domain: string = location.href.indexOf(ele.me) > -1 ? .ele.me : .elenet.me
Cookies.set(WMUSS, res.WMUSS, { domain: this.domain, expires: 30 })
Cookies.set(OPENUSS, res.WMUSS, { domain: this.domain, expires: 30 })

3、删除cookie

    let domain: string = location.href.indexOf(ele.me) > -1 ? .ele.me : .elenet.me;
    Cookies.remove(WMSTOKEN, { domain: domain });
    Cookies.remove(OUTER_AUTH_LOGIN, { domain: domain });
    Cookies.remove(WMUSS, { domain: domain });
    Cookies.remove(COFFEE_TOKEN, { domain: domain });

 

 

 
 

js-cookie对cookie的操作

上一篇:php图片上传存储源码,可实现预览


下一篇:js 方法的一些简写和技巧