第一步
npm i vue-cookies --save
第二部引入cookie
// require
var Vue = require('vue')
Vue.use(require('vue-cookies'))
// es2015 module
import Vue from 'Vue'
import VueCookies from 'vue-cookies'
Vue.use(VueCookies)
设置cookie
this.$cookies.set(keyName, value[, expireTimes[, path[, domain[, secure]]]]) //return this
获取cookie
this.$cookies.get(keyName) // return value
删除cookie
this.$cookies.remove(keyName [, path [, domain]])
存在cookie name
this.$cookies.isKey(keyName)
得到所有的cookie name
this.$cookies.keys()