Former-commit-id: 6d7a4adb3f160ed8ecc06ea9b3f566bffdcc086b
This commit is contained in:
liyang
2018-12-16 19:44:44 +08:00
parent 55ea4dc64c
commit 9e12e91c38
174 changed files with 0 additions and 35568 deletions
-43
View File
@@ -1,43 +0,0 @@
import Cookies from 'js-cookie'
import setting from '@/setting.js'
const cookies = {}
/**
* @description 存储 cookie 值
* @param {String} name cookie name
* @param {String} value cookie value
* @param {Object} setting cookie setting
*/
cookies.set = function (name = 'default', value = '', cookieSetting = {}) {
let currentCookieSetting = {
expires: 1
}
Object.assign(currentCookieSetting, cookieSetting)
Cookies.set(`d2admin-${setting.releases.version}-${name}`, value, currentCookieSetting)
}
/**
* @description 拿到 cookie 值
* @param {String} name cookie name
*/
cookies.get = function (name = 'default') {
return Cookies.get(`d2admin-${setting.releases.version}-${name}`)
}
/**
* @description 拿到 cookie 全部的值
*/
cookies.getAll = function () {
return Cookies.get()
}
/**
* @description 删除 cookie
* @param {String} name cookie name
*/
cookies.remove = function (name = 'default') {
return Cookies.remove(`d2admin-${setting.releases.version}-${name}`)
}
export default cookies