Skip to content

Tag: nuxtjs

localstorage.getItem() not working in NUXT JS

I am trying to develop a shopping cart with nuxt js. I am successfully storing the cart data in local storage but I am unable to retrieve the data. N.B: i don’t wanna use vuex-persistedstate. Answer I see lots of small problems with this. First of all, it looks like you’ve put addToCart and saveInLocalStorage judging by the fact you

Find a specific object in an array of objects

I don’t understand because I use the method “find” but I get “undefined”… My data : I would like to have only the object with the ID 2 for example. So I wrote : But it does not work… I always get “undefined” Thanks for help Answer ID is a number, therefore you need to remove the quotes around 2

Display different video source according to screen size

I am trying to load different videos according to the screen size. I found a solution to doing this using javascript. However, I am not able to integrate this code into nuxt.js. Working Code: HTML JAVASCRIPT The Fiddle: I tried to integrate like this: I would be very thankful for any kind of help! Answer Your code is primarily