How does localStorage get the dynamic storage of the returned value of the interface?

,localStorageID H5+mui+vue APP



http://www.ruanyifeng.com/blo.


https://developer.mozilla.org.


allows the backend to write data to a json file and save it locally, and then request json data like jq

$(function () {
    $.getJSON("data.json",function(data){
        console.log(data)
    })
})

such a json data file is similar to an sql table.


localforage, https://www.npmjs.com/package.


vue's built-in object


can be stored structurally, but I don't know how much data you have

window.localStorage.setItem('outLineList' + '-' + id,JSON.stringify(outLineList));
var outLineList=window.localStorage.getItem('outLineList' + '-' + id) ? JSON.parse(window.localStorage.getItem('outLineList' + '-' + id")) : [];


use HTML5+ 's storage module. It is also in the form of {key,val}. The advantage is that there is no upper limit on the size, as long as your phone has enough memory.

Menu