xwl-sg-to-computed
v1.0.0
Published
"将state和getters批量进行转换成computed的工具函数"
Downloads
4
Maintainers
Readme
安装 npm i xwl-sg-to-computed -S
使用示例
import sgToComputed from 'xwl-sg-to-computed';
sgToComputed: ( keys: string[], origin: string, module_name: string ) => object;
const PopState = reactive({ ...sgToComputed( "hotmenupart", [ "hotSongMenuPart_2", "hotSongMenuPart_3", ], "state" ), });
const mesStore = reactive({ ...sgToComputed( "user", ["refMeCount", "privateMeCount", "commentsMeCount", "noticeMeCount"], "getters" ), }); 说明: /**
- @param { Array } keys - state/getters 中的名称构成的数组 ["t1","t2"]
- @param { string } origin - 来源,"state"/"getters"
- @param { string } module_name - 模块名称 "user" */