In my main component I have:
mounted() {
window.$cookie.set('cookie_name', userName, expiringTime);
},
This yields the following error:
Error in mounted hook: "TypeError: Cannot read property 'set' of undefined"
In my main.js
I have:
import VueCookies from 'vue-cookies';
Vue.use(VueCookies);
Any idea?
You must use window.$cookies
or this.$cookies
(don't forget the s).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With