本地持久化保存数据

const STORAGY_KEY = 'demo-vue'
    const todosStorage = {
        fetch: function () {
            return JSON.parse(localStorage.getItem('STORAGY_KEY ') || '[]')
        },
        save: function (items) {
            localStorage.setItem('STORAGY_KEY ', JSON.stringify(items))
        }

猜你喜欢

转载自www.cnblogs.com/zhaodz/p/11968813.html
今日推荐