diff --git a/packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js b/packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
index 9e7a6a4b37409ab306d2f8023dd64d787902e49a..038465efea630864edf52e64fc55be0040bde040 100644
--- a/packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
+++ b/packages/uni-template-compiler/__tests__/compiler-app-plus-extra.service.spec.js
@@ -61,15 +61,19 @@ describe('codegen', () => {
assertCodegen(
'
',
`with(this){return _c('div',[_l((_$s(1,'f',{forItems:items})),function(item,$10,$20,$30){return [(_$s(("2-"+$30),'i',item.sub))?_c('span',{key:_$s(1,'f',{forIndex:$20,keyIndex:0,key:1+'-0'+$30})}):_e()]})],2)}`
- )
- assertCodegen(
- '{{item}}',
- `with(this){return _c('view',[_l((_$s(1,'f',{forItems:arr,fill:true})),function(item,index,$20,$30){return [_v((_$s(("1-"+$30),'t0',_s(item))))]})],2)}`
- )
- assertCodegen(
- '{{item}}',
- `with(this){return _c('view',[_l((_$s(1,'f',{forItems:arr,fill:true})),function(item,index,$20,$30){return [_v((_$s(("1-"+$30),'t0',_s(item))))]})],2)}`
- )
+ )
+ assertCodegen(
+ '{{item}}',
+ `with(this){return _c('view',[_l((_$s(1,'f',{forItems:arr,fill:true})),function(item,index,$20,$30){return [_v((_$s(("1-"+$30),'t0',_s(item))))]})],2)}`
+ )
+ assertCodegen(
+ '{{item}}',
+ `with(this){return _c('view',[_l((_$s(1,'f',{forItems:arr,fill:true})),function(item,index,$20,$30){return [_v((_$s(("1-"+$30),'t0',_s(item))))]})],2)}`
+ )
+ assertCodegen(
+ '{{item}}',
+ `with(this){return _c('view',[_l((_$s(1,'f',{forItems:arr,fill:true})),function(item,index,$20,$30){return [(_$s(("2-"+$30),'i',item==3))?[_v((_$s(("2-"+$30),'t0',_s(item))))]:_e()]})],2)}`
+ )
})
it('generate text with multiple statements', () => {
assertCodegen(
diff --git a/packages/uni-template-compiler/lib/app/service.js b/packages/uni-template-compiler/lib/app/service.js
index 4f07200c55d0ad5158f35e237fb2af68429b6dc3..fc46da0508fc97543b31242a5b963d4ecafed32f 100644
--- a/packages/uni-template-compiler/lib/app/service.js
+++ b/packages/uni-template-compiler/lib/app/service.js
@@ -92,7 +92,11 @@ function checkAutoFill (el) {
el.tag === 'template' ||
el.tag === 'block'
) &&
- !el.children.find(child => child.type === 1)
+ !el.children.find(child =>
+ child.type === 1 &&
+ child.tag !== 'template' &&
+ child.tag !== 'block'
+ )
) {
return true
}