vuex-maphooks
v1.0.6
Published
Map hooks for vue3&vuex4
Downloads
7
Maintainers
Readme
VUEX-HOOKS
Usage
参照vuex mapState 等函数用法,或直接调用相关hooks会有代码提示.
api
mapStateToComputed(namespace, options) -- overload --> mapStateToComputed(options)
mapMutationsToMethods(namespace, options) -- overload --> mapMutationsToMethods(options)
mapGettersToComputed(namespace, options) -- overload --> mapGettersToComputed(options)
mapActionsToMethods(namespace, options) -- overload --> mapActionsToMethods(options)
examples
// use namespace
const {
rename
} = mapStateToComputed("a/", {
rename : "name"
});
or
const {
name
} = mapStateToComputed("a/", ["name"]);
// no namespace
const {
reCount
} = mapStateToComputed({
reCount : "count"
});
const {
count
} = mapStateToComputed(["count"]);