diff --git a/src/compiler/codegen/index.js b/src/compiler/codegen/index.js index 3416f773d8c..d353b6457b1 100644 --- a/src/compiler/codegen/index.js +++ b/src/compiler/codegen/index.js @@ -406,7 +406,9 @@ export function genChildren ( el.tag !== 'template' && el.tag !== 'slot' ) { - const normalizationType = checkSkip && state.maybeComponent(el) ? `,1` : `` + const normalizationType = checkSkip + ? state.maybeComponent(el) ? `,1` : `,0` + : `` return `${(altGenElement || genElement)(el, state)}${normalizationType}` } const normalizationType = checkSkip diff --git a/test/unit/modules/compiler/codegen.spec.js b/test/unit/modules/compiler/codegen.spec.js index e7eedec98f6..f2c47ed4b6b 100644 --- a/test/unit/modules/compiler/codegen.spec.js +++ b/test/unit/modules/compiler/codegen.spec.js @@ -54,25 +54,25 @@ describe('codegen', () => { it('generate v-for directive', () => { assertCodegen( '
  • ', - `with(this){return _c('div',_l((items),function(item){return _c('li',{key:item.uid})}))}` + `with(this){return _c('div',_l((items),function(item){return _c('li',{key:item.uid})}),0)}` ) // iterator syntax assertCodegen( '
  • ', - `with(this){return _c('div',_l((items),function(item,i){return _c('li')}))}` + `with(this){return _c('div',_l((items),function(item,i){return _c('li')}),0)}` ) assertCodegen( '
  • ', - `with(this){return _c('div',_l((items),function(item,key,index){return _c('li')}))}` + `with(this){return _c('div',_l((items),function(item,key,index){return _c('li')}),0)}` ) // destructuring assertCodegen( '
  • ', - `with(this){return _c('div',_l((items),function({ a, b }){return _c('li')}))}` + `with(this){return _c('div',_l((items),function({ a, b }){return _c('li')}),0)}` ) assertCodegen( '
  • ', - `with(this){return _c('div',_l((items),function({ a, b },key,index){return _c('li')}))}` + `with(this){return _c('div',_l((items),function({ a, b },key,index){return _c('li')}),0)}` ) // v-for with extra element assertCodegen( @@ -126,7 +126,7 @@ describe('codegen', () => { it('generate ref on v-for', () => { assertCodegen( '', - `with(this){return _c('ul',_l((items),function(item){return _c('li',{ref:"component1",refInFor:true})}))}` + `with(this){return _c('ul',_l((items),function(item){return _c('li',{ref:"component1",refInFor:true})}),0)}` ) }) @@ -597,7 +597,7 @@ describe('codegen', () => { it('generate static trees inside v-for', () => { assertCodegen( `

    `, - `with(this){return _c('div',_l((10),function(i){return _c('div',[_m(0,true)])}))}`, + `with(this){return _c('div',_l((10),function(i){return _c('div',[_m(0,true)])}),0)}`, [`with(this){return _c('p',[_c('span')])}`] ) })