小程序的数据绑定能这样写吗?{{item.imageLists[0].url}}

发布于 6 年前作者 rluo11875 次浏览最后编辑 6 年前来自 ask

<image wx:for="{{tempPosts}}" wx:key="id" src="{{item.imageLists[0].url}}" bindload="loadPic" binderror="loadPicError" data-index="{{index}}" />

数据如下:

图片显示不出来

2 回复
dfeng
dfeng1 楼6 年前

可以那样写(如果你不循环,只是写死的话)

若认为该回答有用,给回答者点个[ 有用 ],让答案帮助更多的人

duna
duna2 楼4 年前
<block wx:for="{{tempPosts}}" wx:for-item="itemChild" wx:for-index="idx">
  <image src="{{itemChild.url}}" bindload="loadPic" binderror="loadPicError" data-index="{{idx}}" />
</block>