@vueblocks/vue-use-vuex

Use Vuex With Composition API Easily.
45,662 35
Install
npm install @vueblocks/vue-use-vuex
Latest Version:0.2.11
Vue:2 · 3
License:MIT
Last Updated:Sep 20, 2022
Links: GitHub  ·  npm
Maintainer: xiaoluoboding

@vueblocks/vue-use-vuex

Use Vuex With Composition API Easily.

Install

# Vue 2 with @vue/composition-api
yarn add @vue/composition-api @vueblocks/vue-use-vuex -S
or
npm i @vue/composition-api @vueblocks/vue-use-vuex -S

# Vue 3
yarn add @vueblocks/vue-use-vuex -S
or
npm i @vueblocks/vue-use-vuex -S

Usage

useVuex

useVuex utilities just similar with Vuex Component Binding Helpers

It export these composable helpers:

Differently, useVuex do not export createNamespacedHelpers function, Instead useVuex allow you provide the namespace as first argument, then return will be the namespaced component binding helpers.

Read more about namespacing documention.

useStore

useStore utilities just do the same thing with Vuex 4.x composition api useStore

It seems familiar right?

Typing

/**
 * Get $store from current instance
 * @return {Store} vm.$store
 */
declare const useStore: () => Store<any>;
/**
 * Use Vuex with composition api easily. Both support Vue2.x / Vue3.x
 * @param {String} namespace
 * @param {Store} store ### vm.$store
 */
declare function useVuex(namespace?: string, store?: Store<any>): {
  useState: (namespace?: string, map: Array<string> | Object<string | function>) => Object<ComputedRef>
  useGetters: (namespace?: string, map: Array<string> | Object<string>) => Object<ComputedRef>
  useMutations: (namespace?: string, map: Array<string> | Object<string | function>) => Object
  useActions: (namespace?: string, map: Array<string> | Object<string | function>) => Object
};

Related Packages

@vueblocks/vue-use-core

A Collection of Vue Compositon API Utilities.

4,229 35
vuex-composition-helpers

Helpers to use Vuex store form Vue Composition API

541,700 288
xn-fe-tools

A powerful fetch wrapper with chaining & tuple API

3,748
spyfu-vuex-helpers

Utility functions for Vuex.

2,459 9
vue-native-websocket

Native WebSocket plugin and composable for Vue 3

478,654 935

Version History

Version Released License
0.2.11 MIT
0.2.10 MIT
0.2.5 MIT
0.2.0 MIT
0.1.9 MIT