@mmmrks/vue-stockpile
v1.0.0
Published
Simple & Lighweight state manager for VueJS
Downloads
3
Readme
StockPile
Simple state & store -plugin for VueJS.
Installation
npm install @mmmrks/vue-stockpile
OR
<script src="https://cdn.jsdelivr.net/npm/package@version/file"></sript>
Usage
import StockPile from '@mmmrks/vue-stockpile'
Vue.use(StockPile , new StockPile.Stash({
pile: { // mandatory
count: 0
},
static: { // optional
localhost: "http://localhost:3000"
}
}))
Unlike pile -stash, data inside static -stash can only be written once and is not mandatory.
Access the data:
this.$stock.pile.count
<section>{{$stock.pile.count}}</section>
Set (stash) data:
this.stock.pile.stash("count", this.$stock.pile.count + 1);
Remove (unstash) data:
this.stock.pile.unstash("count");
!! static -stash works just like pile stash except you can set values only once and added values can't be unstashed.