Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kbdsbx/vuex-declaration
https://github.com/kbdsbx/vuex-declaration
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/kbdsbx/vuex-declaration
- Owner: kbdsbx
- Created: 2019-01-15T03:39:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T03:08:17.000Z (over 1 year ago)
- Last Synced: 2024-01-08T08:50:20.513Z (5 months ago)
- Language: JavaScript
- Size: 2.77 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
Lists
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Utilities / State Management)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Utilities / State Management)
- awesome-vue - vuex-declaration - Declare state like props, make state inject to vuex dynamically when component created. (Components & Libraries / Utilities)
README
# Vuex Declaration
Declare state like props, make state inject to vuex dynamically when component created.
## Usage
```bash
npm i vuex-declaration
``````js
import vuecDeclaration from 'vuex-declaration'
import Vue from 'vue'
Vue.use( vuexDeclaration );
``````js
Vue.component( 'self-component', {
data () { ... },
props : [ ... ],
created () { ... },// Declare states
state : [ 'state-a', 'state-b' ],
} )
``````js
export default {
// Declare state with module.
state : {
'state-a' : {
module : 'module-a',
}
}
}
```## Apis
#### setStoreModule
Append states to existing modules.```js
import { setStoreModule } from 'vuex-declaration'setStoreModule( this.$store, [ 'state-a', 'state-b' ] )
```#### resetStoreModule
Unreginster all modules from $store and then reset these.```js
import { resetStoreModule } from 'vuex-declaration'resetStoreModule( this.$store, [ 'state-a', 'state-b' ] )
```