请问这样进行数据绑定为啥不行呢?

小程序 文章 2022-02-17 14:40 261 0 全屏看文

AI助手支持GPT4.0

请问这样进行数据绑定为啥不行呢?Why can't data binding be done in this way?

请问这样进行数据绑定为啥不行呢?

orders是一个对象如下图所示

里面有个字段是_id,我想在点击view组件的时候把这个字段传回去,但是好像无法触发bindtap绑定的事件

我该怎么做才能达到上述目的呢?

Orders is an object, as shown in the figure below. There is a field in it_ ID, I want to pass this field back when I click the view component, but it seems that the bindtap binding event cannot be triggered. What can I do to achieve the above purpose?

回答:

社区技术运营专员-horanzhou:

请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

八九:

打印orders看下,还有方法参数

怀瑾:打印了 请看看~
八九:你这个view块,有最外层嘛,最外层有无方法覆盖
微喵网络:

wx:for要使用的必须是数组。如果是对象要这样写

<view data-order_id="{{orders._id}}"
怀瑾:sorry朋友  我的orders就是数组 数组的元素是一个个的键值对
微喵网络:帖子改掉

-EOF-

AI助手支持GPT4.0