/* * @Description: cookie封装 * @Author: Napier * @LastEditors: Napier * @LastEditorTime: */ export default { /** * @description:设置cookie * @param {*} value:值 * @param {*} saveDays :保存的时间 * @param {*} cookieName :键名 */ setCookie: function (value, saveDays, cookieName) { let date = new Date() date.setTime(date.getTime() + saveDays * 24 * 60 * 60 * 1000) document.cookie = cookieName + '=' + escape(value) + ';expires=' + date.toGMTString() }, /** * @ * @param {*} name * @returns */ getCookie: function (name) { var v = window.document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)') return v ? v[2] : null } }