在 v-template 中使用 if 时 Listview 抛出错误

Listview throwing error when using if in v-template

如果我尝试在我的 v 模板中创建条件,例如 if="transaction.id == 604",我会收到以下错误:

>System.err: Calling js method getView failed
System.err: 
System.err: TypeError: Cannot read property 'scopedFn' of undefined

如果我将其设置为 if="transaction.id",它就可以正常工作。 transaction.id 存在并且值为 604。


    <ListView for="transaction in transactions"  itemTap="onItemTap" height="80%" >
      <v-template if="transaction.id">
         <StackLayout>
            <Label :text="transaction.id" className="placeName" />
            <Label :text="transaction.amounttxt" className="placeName" />
            <Label :text="transaction.insight_text" className="placeName" />
          </StackLayout>
       </v-template>
    </ListView>

您只有一个模板具有 if 条件。当 if 条件失败时,没有回退模板。至少应该有一个没有 if 的模板,以便在其他模板上的所有 if 条件都失败时可以使用它。或者你们中至少有一个 if 应该通过。

如果您想忽略任何列表项的呈现,您应该过滤数组 (transactions) 本身。