From 49f7e07d96e4273b6398caf7a7e2a7c9ef2efa76 Mon Sep 17 00:00:00 2001 From: dobromir-hristov Date: Sat, 21 Mar 2020 18:55:37 +0200 Subject: [PATCH 1/3] feat: update scope-slot detection --- .../create-instance/create-scoped-slots.js | 17 +++++++++++--- .../mounting-options/scopedSlots.spec.js | 23 +++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/packages/create-instance/create-scoped-slots.js b/packages/create-instance/create-scoped-slots.js index d5d0cecaa..d93b61728 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,17 @@ function validateEnvironment(): void { } } -const slotScopeRe = /<[^>]+ slot-scope=\"(.+)\"/ +function isScopedSlot(slotString) { + const slotScopeRe = /<[^>]+ slot-scope="(.+)"/ + const vSlotRe = /