提交 edbe96aa 编写于 作者: D DCloud_LXH

fix(app): triggered component Rebuild when removeUniChild question/140609

上级 eb360560
...@@ -192,6 +192,10 @@ export class UniContainerComponent extends UniComponent { ...@@ -192,6 +192,10 @@ export class UniContainerComponent extends UniComponent {
queuePostActionJob(this.getRebuildFn(), JOB_PRIORITY_REBUILD) queuePostActionJob(this.getRebuildFn(), JOB_PRIORITY_REBUILD)
return super.insertBefore(newChild, refChild) return super.insertBefore(newChild, refChild)
} }
removeUniChild(node: UniNode) {
queuePostActionJob(this.getRebuildFn(), JOB_PRIORITY_REBUILD)
return super.removeUniChild(node)
}
rebuild() { rebuild() {
// 刷新容器组件状态 // 刷新容器组件状态
if (__DEV__) { if (__DEV__) {
......
...@@ -251,11 +251,15 @@ export default /*#__PURE__*/ defineBuiltInComponent({ ...@@ -251,11 +251,15 @@ export default /*#__PURE__*/ defineBuiltInComponent({
} }
if (__PLATFORM__ === 'app') { if (__PLATFORM__ === 'app') {
let isMounted: boolean = false
useRebuild(() => { useRebuild(() => {
state.length = (contentRef.value as HTMLElement).children.length state.length = (contentRef.value as HTMLElement).children.length
// 由于 App 端 onMounted 时机未插入真实位置,需重新执行 if (!isMounted) {
initIndicatorHeight() isMounted = true
initScroller() // 由于 App 端 onMounted 时机未插入真实位置,需重新执行
initIndicatorHeight()
initScroller()
}
}) })
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册