Repository: element-plus/element-plus
File: packages/components/splitter/src/splitter.vue (Vue)

Code before:
  return {
    [`--${ns.b()}-bar-offset`]: lazy.value
      ? `${lazyOffset.value}px`
      : undefined,
  }
})

const onResizeStart = (index: number) => {
  onMoveStart(index)
  emits('resizeStart', index, pxSizes.value)
}

const onResize = (index: number, offset: number) => {
  onMoving(index, offset)

  if (!lazy.value) {
    emits('resize', index, pxSizes.value)
  }
}

const onResizeEnd = async (index: number) => {
  onMoveEnd()

  if (lazy.value) {
    await nextTick()
  }

  emits('resizeEnd', index, pxSizes.value)
}

const onCollapsible = (index: number, type: 'start' | 'end') => {
  onCollapse(index, type)
  emits('collapse', index, type, pxSizes.value)
}

provide(
  splitterRootContextKey,
  reactive({
    panels,
    percentSizes,
    pxSizes,
    layout,
    lazy,
    movingIndex,
    containerSize,
    onMoveStart: onResizeStart,
    onMoving: onResize,
    onMoveEnd: onResizeEnd,
    onCollapse: onCollapsible,
    registerPanel,
    unregisterPanel,

Review comment (bug):
This check seems unnecessary. As far as I know, this issue occurs even without lazy mode.

See this [demo](https://element-plus.run/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8ZWwtYnV0dG9uIEBjbGljaz1cInNpbXVsYXRlRHJhZygxNTAsIDUwKVwiPm1vdmU8L2VsLWJ1dHRvbj5cblxuICA8ZGl2XG4gICAgc3R5bGU9XCJoZWlnaHQ6IDI1MHB4OyBib3gtc2hhZG93OiB2YXIoLS1lbC1ib3JkZXItY29sb3ItbGlnaHQpIDBweCAwcHggMTBweFwiXG4gID5cbiAgICA8ZWwtc3BsaXR0ZXIgQHJlc2l6ZS1lbmQ9XCJoYW5kbGVSZXNpemVFbmRcIj5cbiAgICAgIDxlbC1zcGxpdHRlci1wYW5lbCBzaXplPVwiMzAlXCI+XG4gICAgICAgIDxkaXYgY2xhc3M9XCJkZW1vLXBhbmVsXCI+MTwvZGl2PlxuICAgICAgPC9lbC1zcGxpdHRlci1wYW5lbD5cbiAgICAgIDxlbC1zcGxpdH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-bar-offset`]: lazy.value
      ? `${lazyOffset.value}px`
      : undefined,
  }
})

const onResizeStart = (index: number) => {
  onMoveStart(index)
  emits('resizeStart', index, pxSizes.value)
}

const onResize = (index: number, offset: number) => {
  onMoving(index, offset)

  if (!lazy.value) {
    emits('resize', index, pxSizes.value)
  }
}

const onResizeEnd = async (index: number) => {
  onMoveEnd()
  await nextTick()
  emits('resizeEnd', index, pxSizes.value)
}

const onCollapsible = (index: number, type: 'start' | 'end') => {
  onCollapse(index, type)
  emits('collapse', index, type, pxSizes.value)
}

provide(
  splitterRootContextKey,
  reactive({
    panels,
    percentSizes,
    pxSizes,
    layout,
    lazy,
    movingIndex,
    containerSize,
    onMoveStart: onResizeStart,
    onMoving: onResize,
    onMoveEnd: onResizeEnd,
    onCollapse: onCollapsible,
    registerPanel,
    unregisterPanel,
  })
)
</script>