zrh122
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
22 additions and
2 deletions
-
src/compiler/parser/index.js
-
test/unit/modules/compiler/parser.spec.js
|
@ -86,8 +86,12 @@ export function parse ( |
|
|
platformMustUseProp = options.mustUseProp || no |
|
|
platformMustUseProp = options.mustUseProp || no |
|
|
platformGetTagNamespace = options.getTagNamespace || no |
|
|
platformGetTagNamespace = options.getTagNamespace || no |
|
|
const isReservedTag = options.isReservedTag || no |
|
|
const isReservedTag = options.isReservedTag || no |
|
|
maybeComponent = (el: ASTElement) => !!el.component || !isReservedTag(el.tag) |
|
|
maybeComponent = (el: ASTElement) => !!( |
|
|
|
|
|
el.component || |
|
|
|
|
|
el.attrsMap[':is'] || |
|
|
|
|
|
el.attrsMap['v-bind:is'] || |
|
|
|
|
|
!(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)) |
|
|
|
|
|
) |
|
|
transforms = pluckModuleFunction(options.modules, 'transformNode') |
|
|
transforms = pluckModuleFunction(options.modules, 'transformNode') |
|
|
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode') |
|
|
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode') |
|
|
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode') |
|
|
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode') |
|
|
|
@ -909,4 +909,20 @@ describe('parser', () => { |
|
|
expect(ast.children[2].type).toBe(3) |
|
|
expect(ast.children[2].type).toBe(3) |
|
|
expect(ast.children[2].text).toBe('\ndef') |
|
|
expect(ast.children[2].text).toBe('\ndef') |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// #10152
|
|
|
|
|
|
it('not warn when scoped slot used inside of dynamic component on regular element', () => { |
|
|
|
|
|
parse(` |
|
|
|
|
|
<div> |
|
|
|
|
|
<div is="customComp" v-slot="slotProps"></div> |
|
|
|
|
|
<div :is="'customComp'" v-slot="slotProps"></div> |
|
|
|
|
|
<div v-bind:is="'customComp'" v-slot="slotProps"></div> |
|
|
|
|
|
</div> |
|
|
|
|
|
`, baseOptions)
|
|
|
|
|
|
expect('v-slot can only be used on components or <template>').not.toHaveBeenWarned() |
|
|
|
|
|
|
|
|
|
|
|
parse(`<div is="customComp"><template v-slot="slotProps"></template></div>`, baseOptions) |
|
|
|
|
|
expect(`<template v-slot> can only appear at the root level inside the receiving the component`) |
|
|
|
|
|
.not.toHaveBeenWarned() |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|