-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support rax-componentwrapper #219
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,4 @@ | |||
module.exports = { | |||
WrapperPackage: 'rax-componentwrapper', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个名字要不要再考虑下
if (rootStacks.length > 0) { | ||
if (internal.$batchedUpdates) { | ||
internal.firstRenderCallback(); | ||
this._batchedUpdate(internal, internal, rootStacks, callback); | ||
} else { | ||
const renderObject = Object.create(null); | ||
rootStacks.forEach((task) => { | ||
renderObject[task.path] = isFunction(task.value) ? task.value() : task.value; | ||
}); | ||
internal.firstRenderCallback(renderObject); | ||
internal.setData(renderObject, callback); | ||
} | ||
} | ||
|
||
if (componentWrapperCount > 0) { | ||
Object.values(componentWrapperObject).forEach(({ node, data }) => { | ||
if (internal.$batchedUpdates) { | ||
internal.firstRenderCallback(); | ||
this._batchedUpdate(internal, node._internal, data, callback); | ||
} else { | ||
const renderObject = Object.create(null); | ||
data.forEach((task) => { | ||
renderObject[task.path] = isFunction(task.value) ? task.value() : task.value; | ||
}); | ||
internal.firstRenderCallback(renderObject); | ||
node._internal.setData(renderObject, callback); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段代码里面的逻辑可以抽离出来
|
||
function ensureWrapperFolder() { | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有个空函数
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "miniapp-runtime-config", | |||
"version": "0.3.9", | |||
"version": "0.3.10-2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
版本号
"miniapp-builder-shared": "beta", | ||
"rax-miniapp-babel-plugins": "beta", | ||
"rax-miniapp-config-webpack-plugin": "^2.0.0", | ||
"rax-miniapp-runtime-webpack-plugin": "^4.0.0", | ||
"miniapp-render": "^2.0.0" | ||
"rax-miniapp-runtime-webpack-plugin": "beta", | ||
"miniapp-render": "beta" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
版本号
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "rax-miniapp-babel-plugins", | |||
"version": "0.1.15", | |||
"version": "0.1.16-3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
@@ -22,6 +22,6 @@ | |||
"@babel/code-frame": "^7.8.3", | |||
"fs-extra": "^9.0.1", | |||
"md5": "^2.2.1", | |||
"miniapp-builder-shared": "^0.2.0" | |||
"miniapp-builder-shared": "0.2.11-0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
@@ -21,12 +21,15 @@ | |||
"csso": "^4.0.3", | |||
"fs-extra": "^8.1.0", | |||
"lodash.isequal": "^4.5.0", | |||
"miniapp-builder-shared": "^0.2.0", | |||
"miniapp-builder-shared": "0.2.11-0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
@@ -58,6 +62,7 @@ class MiniAppRuntimePlugin { | |||
let isFirstRender = true; | |||
let lastUsingComponents = {}; | |||
let lastUsingPlugins = {}; | |||
let lastImportComponentWrapper = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
关于 lastUsingXXX 这里之前的逻辑写的有点混乱,看看能否重构一下,或者多验证一下。主要是 npm run start 的时候用户修改代码时能确保正常运行
rax-componentwrapper: raxjs/rax-components#399
在运行时小程序中,默认所有的数据更新都使用
Page
的setData
方法。对于部分需要频繁更新数据的元素来说,可以在元素外包裹rax-componentwrapper
的方式,自动将该元素转成自定义组件,当元素数据发生变化时,使用组件的setData
,来起到性能优化的目的。需要注意:在阿里小程序中,需要开启基础库 2.0 构建或开启 component2 功能时,才能正常使用该组件,否则将降级使用
Page
的setData
方法。