File tree 2 files changed +22
-2
lines changed
test/unit/modules/compiler
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -86,8 +86,12 @@ export function parse (
86
86
platformMustUseProp = options . mustUseProp || no
87
87
platformGetTagNamespace = options . getTagNamespace || no
88
88
const isReservedTag = options . isReservedTag || no
89
- maybeComponent = ( el : ASTElement ) => ! ! el . component || ! isReservedTag ( el . tag )
90
-
89
+ maybeComponent = ( el : ASTElement ) => ! ! (
90
+ el . component ||
91
+ el . attrsMap [ ':is' ] ||
92
+ el . attrsMap [ 'v-bind:is' ] ||
93
+ ! ( el . attrsMap . is ? isReservedTag ( el . attrsMap . is ) : isReservedTag ( el . tag ) )
94
+ )
91
95
transforms = pluckModuleFunction ( options . modules , 'transformNode' )
92
96
preTransforms = pluckModuleFunction ( options . modules , 'preTransformNode' )
93
97
postTransforms = pluckModuleFunction ( options . modules , 'postTransformNode' )
Original file line number Diff line number Diff line change @@ -881,4 +881,20 @@ describe('parser', () => {
881
881
expect ( ast . children [ 2 ] . type ) . toBe ( 3 )
882
882
expect ( ast . children [ 2 ] . text ) . toBe ( '\ndef' )
883
883
} )
884
+
885
+ // #10152
886
+ it ( 'not warn when scoped slot used inside of dynamic component on regular element' , ( ) => {
887
+ parse ( `
888
+ <div>
889
+ <div is="customComp" v-slot="slotProps"></div>
890
+ <div :is="'customComp'" v-slot="slotProps"></div>
891
+ <div v-bind:is="'customComp'" v-slot="slotProps"></div>
892
+ </div>
893
+ ` , baseOptions )
894
+ expect ( 'v-slot can only be used on components or <template>' ) . not . toHaveBeenWarned ( )
895
+
896
+ parse ( `<div is="customComp"><template v-slot="slotProps"></template></div>` , baseOptions )
897
+ expect ( `<template v-slot> can only appear at the root level inside the receiving the component` )
898
+ . not . toHaveBeenWarned ( )
899
+ } )
884
900
} )
You can’t perform that action at this time.
1 commit comments
2472289148 commentedon Nov 7, 2019
Thanks for your code, it's very userful, but why cant merge with dev branch?