fix(compiler): maybeComponent should return true when "is" attribute exists (#8114)

close #8101
This commit is contained in:
Jovino Xu 2018-10-25 00:50:42 +08:00 committed by Evan You
parent f5b5b3c96f
commit aef2a5f3db
2 changed files with 6 additions and 1 deletions

View File

@ -26,7 +26,7 @@ export class CodegenState {
this.dataGenFns = pluckModuleFunction(options.modules, 'genData')
this.directives = extend(extend({}, baseDirectives), options.directives)
const isReservedTag = options.isReservedTag || no
this.maybeComponent = (el: ASTElement) => !isReservedTag(el.tag)
this.maybeComponent = (el: ASTElement) => !(isReservedTag(el.tag) && !el.component)
this.onceId = 0
this.staticRenderFns = []
}

View File

@ -524,6 +524,11 @@ describe('codegen', () => {
'<div :is="component1"></div>',
`with(this){return _c(component1,{tag:"div"})}`
)
// maybe a component and normalize type should be 1
assertCodegen(
'<div><div is="component1"></div></div>',
`with(this){return _c('div',[_c("component1",{tag:"div"})],1)}`
)
})
it('generate component with inline-template', () => {