1.0.0 • Published 3 years ago

@mmmrks/vue-stockpile v1.0.0

Weekly downloads
33
License
ISC
Repository
github
Last release
3 years ago

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.