123456789101112131415161718192021 |
- /*
- * @Description:
- * @Author: Napier
- * @LastEditors: Napier
- * @LastEditorTime:
- */
- // cookie封装
- export default {
- // 设置cookie
- 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()
- },
- // 获取cookie
- getCookie: function (name) {
- var v = window.document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)')
- return v ? v[2] : null
- }
- }
|