在wxml文件中无法使用typeof函数的问题
发布于 5 年前 作者 min10 13932 次浏览 来自 问答

你想反馈一个 Bug 还是 提一个需求?

bug

如果是 Bug:

* Bug 表现是什么?预期表现是什么?

在wxml中无法利用typeof函数获得对象中元素的类型。

* 如何复现?

* 提供一个最简复现 Demo

index.js中,data对象中包涵如下对象:

data: {
reqList:[{'aa':'aa1'},{'aa':'aa2'}]
},

index.wxml中,有以下 语句

<view class="weui-panel" wx:for="{{reqList}}" wx:key="aaa">
{{typeof(item.aa)}}
   {{typeof(item.bb)}}
</view>

本来应该希望显示:

string undefined

string undefined

但实际上什么都不显示。

回到顶部