Skip to content

Commit

Permalink
refactor: 入参为空数组时,调用 doSetByRefs 方法不执行 selectAllComponents
Browse files Browse the repository at this point in the history
  • Loading branch information
Otto-J committed Nov 8, 2024
1 parent 79fa5ba commit 1bd8310
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/uni-mp-vue/src/rendererTemplateRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export function setRef(instance: ComponentInternalInstance, isUnmount = false) {
const check = $mpPlatform === 'mp-baidu' || $mpPlatform === 'mp-toutiao'

const doSetByRefs = (refs: TemplateRef[]) => {
const mpComponents =
// 字节小程序 selectAllComponents 可能返回 null
// https://github.com/dcloudio/uni-app/issues/3954
($scope.selectAllComponents('.r') || []).concat(
$scope.selectAllComponents('.r-i-f') || [],
)
return refs.filter(templateRef => {
const mpComponents =
// 字节小程序 selectAllComponents 可能返回 null
// https://github.com/dcloudio/uni-app/issues/3954
($scope.selectAllComponents('.r') || []).concat(
$scope.selectAllComponents('.r-i-f') || [],
)
const refValue = findComponentPublicInstance(mpComponents, templateRef.i)
// 部分平台,在一些 if 条件下,部分 slot 组件初始化会被延迟到下一次渲染,需要二次检测
if (check && refValue === null) {
Expand Down

0 comments on commit 1bd8310

Please sign in to comment.