alfhen / vue-cookie

A Vue.js plugin for manipulating cookies
MIT License
822 stars 72 forks source link

nuxt suport? #17

Closed gabrielmancini closed 7 years ago

gabrielmancini commented 7 years ago

not work here ;-(

alfhen commented 7 years ago

@gabrielmancini I haven't used Nuxt before and thus does not know what the problems are, but if you are willing to make a fork with a test branch where you set up Nuxt and vue-cookie then I am happy to take a look at it.

gabrielmancini commented 7 years ago

its working now :-)

alfhen commented 7 years ago

@gabrielmancini Okay, I am glad you got it working 👍

lukasborawski commented 7 years ago

@gabrielmancini what did you do? I have undefined on this.$cookie object, i'm using Nuxt too.

gabrielmancini commented 7 years ago

src/plugins/vue-cookie.js

import Vue from 'vue';
import VueCookie from 'vue-cookie';
Vue.use(VueCookie);
const cookie = VueCookie;
export default cookie;

nuxt.config.js

{
...
  plugins: [
    {src: '~plugins/vue-strap', ssr: false},
    {src: '~plugins/vue-i18n', ssr: false},
    {src: '~plugins/vue-cookie', ssr: false, injectAs: 'cookie'}
  ],
...
outOFFspace commented 6 years ago

How about without nuxt?

vodnicearv commented 5 years ago

my working /plugins/vue-cookie.js file is:

import Vue from 'vue'
import VueCookie from 'vue-cookie'
Vue.use(VueCookie)
export default function ({ app }, inject) {
  inject('cookie', VueCookie)
}

nuxt@2.2.0 vue-cookie@1.1.4

volkanciloglu commented 4 years ago

with nuxt middleware support ?