npm install cookie-universal-nuxt -s
在nuxt.config.js
添加
modules: [
'cookie-universal-nuxt',
['cookie-universal-nuxt', { alias: 'cookiz' }],
],
设置cookie
this.$cookies.set('token', data.token)
在asyncData
打印
async asyncData({ app }) {
console.log(app.$cookies.get("token"));
},