Skip to content

Commit

Permalink
fix(compiler): maybeComponent should return true when "is" attribute …
Browse files Browse the repository at this point in the history
…exists (#8114)

close #8101
  • Loading branch information
javoski authored and yyx990803 committed Oct 24, 2018
1 parent f5b5b3c commit aef2a5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit aef2a5f

Please sign in to comment.