diff --git a/src/compiler/codegen/index.js b/src/compiler/codegen/index.js index fc376bc1aee..dd2e62b85fb 100644 --- a/src/compiler/codegen/index.js +++ b/src/compiler/codegen/index.js @@ -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 = [] } diff --git a/test/unit/modules/compiler/codegen.spec.js b/test/unit/modules/compiler/codegen.spec.js index 93a27f3b245..126453555f1 100644 --- a/test/unit/modules/compiler/codegen.spec.js +++ b/test/unit/modules/compiler/codegen.spec.js @@ -524,6 +524,11 @@ describe('codegen', () => { '
', `with(this){return _c(component1,{tag:"div"})}` ) + // maybe a component and normalize type should be 1 + assertCodegen( + '
', + `with(this){return _c('div',[_c("component1",{tag:"div"})],1)}` + ) }) it('generate component with inline-template', () => {