Skip to content

Commit aef2a5f

Browse files
javoskiyyx990803
authored andcommitted
fix(compiler): maybeComponent should return true when "is" attribute exists (#8114)
close #8101
1 parent f5b5b3c commit aef2a5f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/compiler/codegen/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class CodegenState {
2626
this.dataGenFns = pluckModuleFunction(options.modules, 'genData')
2727
this.directives = extend(extend({}, baseDirectives), options.directives)
2828
const isReservedTag = options.isReservedTag || no
29-
this.maybeComponent = (el: ASTElement) => !isReservedTag(el.tag)
29+
this.maybeComponent = (el: ASTElement) => !(isReservedTag(el.tag) && !el.component)
3030
this.onceId = 0
3131
this.staticRenderFns = []
3232
}

test/unit/modules/compiler/codegen.spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,11 @@ describe('codegen', () => {
524524
'<div :is="component1"></div>',
525525
`with(this){return _c(component1,{tag:"div"})}`
526526
)
527+
// maybe a component and normalize type should be 1
528+
assertCodegen(
529+
'<div><div is="component1"></div></div>',
530+
`with(this){return _c('div',[_c("component1",{tag:"div"})],1)}`
531+
)
527532
})
528533

529534
it('generate component with inline-template', () => {

0 commit comments

Comments
 (0)