js如何更改cookies的某个值

我先设置一个cookie,

currentGlobalStyle = true;

document.cookie = 'currentGlobalStyle=true';

现在的输出结果是:

login_region="http://192.168.6.85:5000/v2.0"; scope=system_admin; recent_project=123; currentGlobalStyle=true; csrftoken=123

当我退出登录,或者执行某个方法时,如何将currentGlobalStyle改为false。

阅读 3.6k
1 个回答

如果域名和路径相同的话,直接设置一个currentGlobalStyle为false的cookie就会把之前的覆盖掉

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题