Skip to content
/ vlf Public

A Vue plugin from localForage.vue-localForage or vlf

Notifications You must be signed in to change notification settings

dmlzj/vlf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Apr 27, 2020
667f75f · Apr 27, 2020

History

23 Commits
Apr 27, 2020
Apr 27, 2020
Sep 25, 2017
Apr 27, 2020
Jan 10, 2020
Apr 27, 2020
Apr 23, 2020

Repository files navigation

vlf

vue-localforage and support typescript

localForage is a fast and simple storage library for JavaScript. localForage improves the offline experience of your web app by using asynchronous storage (IndexedDB or WebSQL) with a simple, localStorage-like API.

localForage uses localStorage in browsers with no IndexedDB or WebSQL support. See [the wiki for detailed compatibility info][supported browsers].

Install

npm install  --save localforage vlf

How to use vlf

import Vlf from 'vlf'
import localforage from 'localforage'
Vue.use(Vlf, localforage)

In your code

// 创建实例
this.$vlf.createInstance({
    storeName: 'user'
})
// 迭代
this.$vlf.iterate((value, key, num) => {
    console.log(key);
});
// 设置值
this.$vlf.setItem('test', 'hello').then(v => {
    console.log(v);
});

// ...和官方调用一致
// The other methods of use are the same as the official website, just add a this.$vlf in front, the same behind!