vue-cache-data
v1.5.1
Published
VueCacheData provides reactive cache data and fetched until first access
Downloads
73
Maintainers
Readme
vue-cache-data
VueCacheData provides reactive cache data and fetched until first access
Install
npm install vue-cache-data --save
Usage
<div id="demo">
<h1>vue cache</h1>
<ul>
<li v-for="stock in stockList">{{ stock }}</li>
</ul>
</div>
import Vue from 'vue'
import VueCacheData from 'vue-cache-data'
Vue.use(VueCacheData)
let AppCache = new VueCacheData()
AppCache.add('stockList', () => ['NJ', 'JX'], function (onSucc, onFail) {
setTimeout(function () {
return onSucc(['BJ', 'SH', 'SZ', 'GZ'])
}, 3000)
})
AppCache.init()
new Vue ({
el: '#demo',
computed: {
stockList () {
return AppCache.vm.stockList
}
}
})