[Vuejs]-How to check localstorage in data Vue.js

4👍

I think you need a fallback in case the localStorage is empty :

{
    el: '.row',
    data:{
        cap:undefined,
        ti:undefined,
        forLS:JSON.parse(localStorage.getItem("allData") || '{ "items":[] }'),
        count:JSON.parse(localStorage.getItem("count") || '-1' )
}

Actually here is a working fork of your fiddle

Leave a comment