Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 10 commits into from
Oct 24, 2018
2 changes: 1 addition & 1 deletion src/compiler/codegen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
}
Expand Down
5 changes: 5 additions & 0 deletions test/unit/modules/compiler/codegen.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down