UNPKG

byt-ui

Version:

byt组件库

33 lines (30 loc) 803 B
/* * @Description: * @Author: 王国火 * @Date: 2022-10-18 12:37:03 * @LastEditTime: 2024-04-22 19:23:05 * @LastEditors: 王国火 */ import Cookie from 'js-cookie' import website from './website' export const getCookie = (key) => { const fullKey = `${website.key}-${key}`; return Cookie.get(fullKey, { // domain: window.location.hostname }) || '' } export const setCookie = (key, value, expires = 7, path = '/') => { const fullKey = `${website.key}-${key}`; return Cookie.set(fullKey, value, { expires, path // domain: window.location.hostname }) } export const removeCookie = (key, path = '/') => { const fullKey = `${website.key}-${key}`; return Cookie.remove(fullKey, { path // domain: window.location.hostname }) }