diff --git a/packages/create-instance/create-scoped-slots.js b/packages/create-instance/create-scoped-slots.js index d5d0cecaa..50464d9ee 100644 --- a/packages/create-instance/create-scoped-slots.js +++ b/packages/create-instance/create-scoped-slots.js @@ -5,7 +5,7 @@ import { throwError } from 'shared/util' import { VUE_VERSION } from 'shared/consts' function isDestructuringSlotScope(slotScope: string): boolean { - return slotScope[0] === '{' && slotScope[slotScope.length - 1] === '}' + return /^{.*}$/.test(slotScope) } function getVueTemplateCompilerHelpers( @@ -46,7 +46,36 @@ function validateEnvironment(): void { } } -const slotScopeRe = /<[^>]+ slot-scope=\"(.+)\"/ +function isScopedSlot(slot) { + if (typeof slot === 'function') return { match: null, slot } + + const slotScopeRe = /<[^>]+ slot-scope="(.+)"/ + const vSlotRe = /