提交 5fd95628 编写于 作者: fxy060608's avatar fxy060608

fix(mp): fix edge case when slot is undefined (#3346)

上级 ec59c14b
...@@ -57,6 +57,10 @@ function createScopedSlotInvoker(instance: ComponentInternalInstance) { ...@@ -57,6 +57,10 @@ function createScopedSlotInvoker(instance: ComponentInternalInstance) {
index?: number index?: number
) => { ) => {
const slot = invoker.slots[slotName] const slot = invoker.slots[slotName]
if (!slot) {
// slot 可能不存在 https://github.com/dcloudio/uni-app/issues/3346
return
}
const hasIndex = typeof index !== 'undefined' const hasIndex = typeof index !== 'undefined'
index = index || 0 index = index || 0
// 确保当前 slot 的上下文,类似 withCtx // 确保当前 slot 的上下文,类似 withCtx
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册