@dimjs/model-wxmp
v1.2.3
Published
The wxmp based state management of @dimjs
Downloads
76
Maintainers
Readme
@dimjs/model-wxmp
the wxmp based state management of @dimjs
The usages
$ npm i @dimjs/model-wxmpFeatures
- Full models api supports includes:
actions,getActions,getInitialState,getState,subscribe,unsubscribe,useStore - For big performance improvement, provides differential
statedata forsetData. - Share
$modelsfor multiple miniprogram page - Shared the
$modelsforComponentsPage - Miniprogram
TypedApiconnect(models).Page|Component()supported. - The detailed examples for full
scenario.
Notes
"noImplicitThis": true,- In order to generated
index.d.tsusingimport {} from @dimjs/modelwe must be setup some configurations as below.
// faltjs.dts.js
{
compilationOptions: {
followSymlinks: false,
},
entries: [
libraries: {
importedLibraries: ['@dimjs/model'],
},
]
}// tsconfig.json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
// setup "paths" is {}
"paths": {}
}
}- We must be manully install
@types/wechat-miniprogram": "^3.2.0"in your project.
reference sites:
https://github.com/Tencent/westore/blob/master/packages/westore/utils/create.js https://github.com/cnyballk/wenaox https://github.com/charleyw/wechat-weapp-redux-todos/blob/master/src/utils/enhancedConnect.js
Notes
小程序编译引擎在压缩编译模式下会出现解析异常, 初步定位是小程序编译器的缺陷
pluginConfigs: {
terser: {
options: {
// 使用快速编译模式, 小程序工作正常.
compress: false,
mangle: true,
},
},
...