1.2.1 • Published 2 years ago
@softvisio/vue-store v1.2.1
:information_source: Please, see the full project documentation here: https://softvisio-node.github.io/vue-store/.
Introduction
Create store from ES class.
Install
npm i @softvisio/vue-store
Usage
import VueStore from "@softvisio/vue-store";
class Store extends VueStore {
// non-reactive properties
__prop1;
_prop2 = 1;
// reactive properties
state11; // reactive state property
_state1 = "test"; // protected reactive state property with initial value
// reactive getter
get getter1() {
return this.state1 + _protectedState1;
}
// setter is just setter, no special behaviour is defined
set getter1 () {}
// actions
async action1 (value ) {
this.state1 += value;
}
};
export default Store.new( "my-store-id" );
- All enumerable properties become reactive state properties, except properties starts with
__
. - All
get
accessors become reactive getters, returned values are cached (refer to thevuex
getters documentation).