Releases: galvez/vue-stator
v1.2.0
v1.2.0 (contains breaking changes! 💔)
As the beta release seemed stable we are releasing v1.2.0. Although its normally ill-advised, this release ships some breaking changes. The main reason why we not didnt release a new major release is that we released v1 only last week and with ~200 weekly downloads it seemed a bit optimistic to release v2 already.
Also the breaking changes are actually mostly bug fixes, as the docs already stated that getters/actions had the same fingerprint as Vuex getters/actions but that wasnt true. We are fixing that in this release but strictly speaking that is a breaking change.
Features
- expose $set / $delete on store instance (68c4334)
These functions are convenience shortcuts to Vue.set and Vue.delete so you dont have to import Vue everywhere.
myAction({ state }) {
this.$set(state, 'propThatDidntExistYet', true)
}
- add mixin to map state by component option (f6d9809)
No more mapState, mapGetters or mapActions! See the readme for more info
- allow statorMap to be a function (5e32620)
Bug Fixes
v1.1.1
Release v1.1
The focus of this release was to improve the Nuxt.js module usability.
Also it add supports to alias module state by passing an object where the keys are the aliases:
computed: {
...mapState({ alias: 'my/module/test' })
}
Features
- use nuxt vuex module for stator initialization (b72b62e)
- nuxt: add disableVuex option (a307f8d)
- support map aliases (d066f6e)
Bug Fixes
v1.0.0
Release v1.0.0 🎉
We are releasing vue-stator v1 as we are introducing some breaking changes:
- full module support with namespacing
this breaks the old syntax that required you to pass two arguments. Similar to Vuex, vue-stator now uses slashed namespace paths to e.g. map state, getters and actions. - abstracted storage
You can easily add any storage which has a similar interface asStorage
(only the getItem and setItem methods are really required)
See the updated readme for more information
Registering module example
const myModule = {
state() {
return {
myVar: 2
}
}
}
const config = {
state() {
return {
rootVar: 1
}
},
modules: {
'my/module': myModule
}
}
const stator = createStore(config)
stator.$state.rootVar // => 1
stator.$state.my.module.myVar // => 2
Or you can also register the module dynamically:
const stator = createStore(config)
stator.registerModule(myModule, 'my/module')
Namespacing syntax example
Old syntax:
// store/state.js
export default () => ({
rootVar: 1,
my: {
myVar: 2
}
})
// store/my.js
export const getters = {
myGetter(state) {
return state.myVar
}
}
// within component.vue
computed: {
...mapGetters(['my', 'myGetter'])
}
New syntax:
// store/state.js
export default () => ({
rootVar: 1
})
// store/my.js
export const state = () => ({
myVar: 2
})
export const getters = {
myGetter(state) {
return state.myVar
}
}
// within component.vue
computed: {
...mapGetters(['my/myGetter'])
}