+30
-15
lines changedFilter options
+30
-15
lines changed Original file line number Diff line number Diff line change
@@ -488,7 +488,12 @@ function parseTag(
488
488
const options = context.options
489
489
if (!context.inVPre && !options.isCustomElement(tag)) {
490
490
const hasVIs = props.some(
491
-
p => p.type === NodeTypes.DIRECTIVE && p.name === 'is'
491
+
p =>
492
+
p.name === 'is' &&
493
+
// v-is="xxx" (TODO: deprecate)
494
+
(p.type === NodeTypes.DIRECTIVE ||
495
+
// is="vue:xxx"
496
+
(p.value && p.value.content.startsWith('vue:')))
492
497
)
493
498
if (options.isNativeTag && !hasVIs) {
494
499
if (!options.isNativeTag(tag)) tagType = ElementTypes.COMPONENT
Original file line number Diff line number Diff line change
@@ -230,21 +230,28 @@ export function resolveComponentType(
230
230
context: TransformContext,
231
231
ssr = false
232
232
) {
233
-
const { tag } = node
233
+
let { tag } = node
234
234
235
235
// 1. dynamic component
236
-
const isProp = isComponentTag(tag)
237
-
? findProp(node, 'is')
238
-
: findDir(node, 'is')
236
+
const isExplicitDynamic = isComponentTag(tag)
237
+
const isProp =
238
+
findProp(node, 'is') || (!isExplicitDynamic && findDir(node, 'is'))
239
239
if (isProp) {
240
-
const exp =
241
-
isProp.type === NodeTypes.ATTRIBUTE
242
-
? isProp.value && createSimpleExpression(isProp.value.content, true)
243
-
: isProp.exp
244
-
if (exp) {
245
-
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
246
-
exp
247
-
])
240
+
if (!isExplicitDynamic && isProp.type === NodeTypes.ATTRIBUTE) {
241
+
// <button is="vue:xxx">
242
+
// if not <component>, only is value that starts with "vue:" will be
243
+
// treated as component by the parse phase and reach here.
244
+
tag = isProp.value!.content.slice(4)
245
+
} else {
246
+
const exp =
247
+
isProp.type === NodeTypes.ATTRIBUTE
248
+
? isProp.value && createSimpleExpression(isProp.value.content, true)
249
+
: isProp.exp
250
+
if (exp) {
251
+
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
252
+
exp
253
+
])
254
+
}
248
255
}
249
256
}
250
257
@@ -416,8 +423,11 @@ export function buildProps(
416
423
isStatic = false
417
424
}
418
425
}
419
-
// skip :is on <component>
420
-
if (name === 'is' && isComponentTag(tag)) {
426
+
// skip is on <component>, or is="vue:xxx"
427
+
if (
428
+
name === 'is' &&
429
+
(isComponentTag(tag) || (value && value.content.startsWith('vue:')))
430
+
) {
421
431
continue
422
432
}
423
433
properties.push(
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4