@vueblocks/vue-use-vuex
Advanced tools
Comparing version
/*! | ||
* @vueblocks/vue-use-vuex v0.2.5 | ||
* @vueblocks/vue-use-vuex v0.2.10 | ||
* (c) 2021 xiaoluoboding | ||
@@ -205,10 +205,10 @@ * @license MIT | ||
* Get $store from current instance | ||
* @return {Store} vm.$store | ||
* @return {Store} instance.$store | ||
*/ | ||
const useStore = () => { | ||
const vm = vueDemi.getCurrentInstance(); | ||
if (!vm) { | ||
const instance = vueDemi.getCurrentInstance(); | ||
if (!instance) { | ||
console.error('You must use this function within the "setup()" method'); | ||
} | ||
return vueDemi.isVue3 ? vm.ctx.$store : vm.proxy.$store; | ||
return vueDemi.isVue3 ? instance.ctx.$store : instance.proxy.$store; | ||
}; | ||
@@ -215,0 +215,0 @@ /** |
@@ -44,3 +44,3 @@ import { Store } from 'vuex'; | ||
* Get $store from current instance | ||
* @return {Store} vm.$store | ||
* @return {Store} instance.$store | ||
*/ | ||
@@ -47,0 +47,0 @@ declare const useStore: () => Store<any>; |
/*! | ||
* @vueblocks/vue-use-vuex v0.2.5 | ||
* @vueblocks/vue-use-vuex v0.2.10 | ||
* (c) 2021 xiaoluoboding | ||
@@ -201,10 +201,10 @@ * @license MIT | ||
* Get $store from current instance | ||
* @return {Store} vm.$store | ||
* @return {Store} instance.$store | ||
*/ | ||
const useStore = () => { | ||
const vm = getCurrentInstance(); | ||
if (!vm) { | ||
const instance = getCurrentInstance(); | ||
if (!instance) { | ||
console.error('You must use this function within the "setup()" method'); | ||
} | ||
return isVue3 ? vm.ctx.$store : vm.proxy.$store; | ||
return isVue3 ? instance.ctx.$store : instance.proxy.$store; | ||
}; | ||
@@ -211,0 +211,0 @@ /** |
/*! | ||
* @vueblocks/vue-use-vuex v0.2.5 | ||
* @vueblocks/vue-use-vuex v0.2.10 | ||
* (c) 2021 xiaoluoboding | ||
@@ -65,3 +65,3 @@ * @license MIT | ||
const module = store._modulesNamespaceMap[namespace]; | ||
if ( !module) { | ||
if (!module) { | ||
console.error(`[vuex] module namespace not found in ${helper}(): ${namespace}`); | ||
@@ -79,3 +79,3 @@ } | ||
const res = {}; | ||
if ( !isValidMap(states)) { | ||
if (!isValidMap(states)) { | ||
console.error('[vuex] useState: mapper parameter must be either an Array or an Object'); | ||
@@ -112,3 +112,3 @@ } | ||
const res = {}; | ||
if ( !isValidMap(mutations)) { | ||
if (!isValidMap(mutations)) { | ||
console.error('[vuex] useMutations: mapper parameter must be either an Array or an Object'); | ||
@@ -142,3 +142,3 @@ } | ||
const res = {}; | ||
if ( !isValidMap(getters)) { | ||
if (!isValidMap(getters)) { | ||
console.error('[vuex] useGetters: mapper parameter must be either an Array or an Object'); | ||
@@ -153,3 +153,3 @@ } | ||
} | ||
if ( !(val in store.getters)) { | ||
if (!(val in store.getters)) { | ||
console.error(`[vuex] unknown getter: ${val}`); | ||
@@ -173,3 +173,3 @@ return; | ||
const res = {}; | ||
if ( !isValidMap(actions)) { | ||
if (!isValidMap(actions)) { | ||
console.error('[vuex] useActions: mapper parameter must be either an Array or an Object'); | ||
@@ -211,10 +211,10 @@ } | ||
* Get $store from current instance | ||
* @return {Store} vm.$store | ||
* @return {Store} instance.$store | ||
*/ | ||
const useStore = () => { | ||
const vm = vueDemi.getCurrentInstance(); | ||
if (!vm) { | ||
const instance = vueDemi.getCurrentInstance(); | ||
if (!instance) { | ||
console.error('You must use this function within the "setup()" method'); | ||
} | ||
return vueDemi.isVue3 ? vm.ctx.$store : vm.proxy.$store; | ||
return vueDemi.isVue3 ? instance.ctx.$store : instance.proxy.$store; | ||
}; | ||
@@ -221,0 +221,0 @@ /** |
{ | ||
"name": "@vueblocks/vue-use-vuex", | ||
"description": "Use Vuex With Composition API Easily.", | ||
"version": "0.2.5", | ||
"version": "0.2.10", | ||
"main": "lib/index.cjs.js", | ||
@@ -32,12 +32,12 @@ "types": "lib/index.d.ts", | ||
"peerDependencies": { | ||
"vuex": "^3.6.0" | ||
"vuex": "^3.6.2" | ||
}, | ||
"dependencies": { | ||
"@vue/composition-api": "^1.0.0-beta.24", | ||
"vue-demi": "^0.5.4" | ||
"@vue/composition-api": "^1.0.0-rc.3", | ||
"vue-demi": "^0.7.1" | ||
}, | ||
"devDependencies": { | ||
"vuex": "^3.6.0" | ||
"vuex": "^3.6.2" | ||
}, | ||
"gitHead": "dcccf2ff7bf0b838ac5b07da9c2680f902b7728f" | ||
"gitHead": "753b0c160daca0d2fba64dc0efe4039d904c989f" | ||
} |
37491
0.24%+ Added
- Removed
Updated