1.使用cookie-universal插件时设置token失效
cookies.set('token', token, {
domain: location.href.indexOf('baidu.com') != -1 ? '.baidu.com' : '',
path: '/'
})
2.通过document.cookie设置跨域token失效
(1)删除cookie
document.cookie = 'token=; path=/; expires=' + new Date(0).toUTCString();
document.cookie = 'token=; path=/; domain=.baidu.com; expires=' + new Date(0).toUTCString();
(2)设置cookie
document.cookie = `token=token;path=/;expires;domain='.baidu.com`;