Skip to content

v-for内v-if元素内的filter报错 #2011

Closed
@Dizzy-zz

Description

问题描述
在v-for循环内,v-if的元素里面使用filter编译报错
[Vue warn]: Error in render: "TypeError: Cannot read property 'type' of undefined"
Cannot read property 'type' of undefined

复现步骤

<view v-for="item in list" :key="item.type">
      <template v-if="item.type === 1">
        <view>{{item.type | test}}</view>
      </template>
</view>

[或者可以直接贴源代码]

预期结果
正常的编译

实际结果
控制台报错
[Vue warn]: Error in render: "TypeError: Cannot read property 'type' of undefined"
Cannot read property 'type' of undefined
元素无法显示

系统信息:

  • 发行平台: 支付宝小程序
  • 操作系统: Mac10.15.6 支付宝小程序开发工具
  • HBuilderX版本: 2.8.5
  • uni-app版本:2.0.0-28520200811001

补充信息
[可选]
[根据你的分析,出现这个问题的原因可能在哪里?]

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions