import JsCookie from 'js-cookie' /** * * @param {String} name 名称 * @param {*} value 值 * @param {Object} cookieSetting 配置 */ export function setCookie(name = 'default', value, cookieSetting) { const currentCookieSetting = { expires: 1 } Object.assign(currentCookieSetting, cookieSetting) JsCookie.set(`VBI-${name}`, value, currentCookieSetting) } /** * * @param {String} name */ export function getCookie(name = 'default') { return JsCookie.get(`VBI-${name}`) } /** * 获取全部cookie */ export function getCookieAll() { return JsCookie.get() } /** * * @param {String} name 名称 */ export function removeCookie(name) { return JsCookie.remove(`VBI-${name}`) }