js-cookie
A simple, lightweight JavaScript API for handling cookies.
一个简单、轻量级的JavaScript API,用于处理cookie。文章来源:https://www.toymoban.com/news/detail-465501.html
示例用法
:文章来源地址https://www.toymoban.com/news/detail-465501.html
import Cookies from "js-cookie";
const TokenKey = "Admin-Token";
export function getToken() {
return Cookies.get(TokenKey);
}
export function setToken(token) {
return Cookies.set(TokenKey, token);
}
export function removeToken() {
return Cookies.remove(TokenKey);
}
export function setUserCode(userCode) {
return Cookies.set("userCode", userCode);
}
export function removeUserCode() {
return Cookies.remove("userCode");
}
export function getUserCode() {
return Cookies.get("userCode");
}
到了这里,关于前端用于处理cookie的js库 js-cookie的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!