页面的wx:for 如何引用 data内的其他变量?

小程序 文章 2020-08-11 18:01 789 0 全屏看文

AI助手支持GPT4.0

页面的wx:for 如何引用 data内的其他变量?How does the page's wx:for reference other variables in data?

页面的wx:for 如何引用 data内的其他变量?

js数据:

data:{

myArray:[1,2,3],

otherData:xxx

}

页面:

《view wx:for={{myArray}} ..... 》

{{otherData}} //作用域的问题,这里得不到数据 ,2年前我解决过一次,前面加个语法类似 {{parent.otherData}} 但具体忘记了。高人给偶老年痴呆一个语法呗? 补充:也可能我记忆错位了。解决过其他前端框架类似问题。而不是微信小程序的。

还能编辑吗?呃,问题有变化,是我在页面得不到Data内定义为Map集合的数据。。。。打扰了各位。。。

《/view》

JS data: data: {myArray: [1,2,3], otherData:xxx }Page: View Wx: for = {myArray}}}} / / scope problem, no data is available here. I solved it once two years ago, and added a syntax similar to it{{ parent.otherData }}But I forgot. Senior people give me a grammar for Alzheimer's disease? Add: Maybe my memory is misplaced. Solved similar problems in other front-end frameworks. Not wechat applet. Can you edit it? Er, the problem has changed. I can't get the data defined as the map set in the data on the page.... Excuse me... 《/view》

回答:

IT.野狐禅:

js: data{ otherData:new Map(...) } //初识化数据了

页面: {{otherData.get(0) }} 得不到

页面直接:{{otherData}} 能有显示 [object]

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
求助!超出限制怎么办?
企业微信wx.openSetting 为什么打开以后授权页面的信息为空?
新手问下setdata问题?
wx.downloadFile/wx.getImageInfo 获取图片路径 尾缀为.unknow?
企业微信中微文档收集表功能收集所在部门为空
随便看看
小程序测试号解绑之后,扫一扫小程序登录又回来了 2101
微信公众号openid? 2347
微信开放平台跟公众平台有什么区别? 3607
怎么添加小程序支付功能? 4516
教育科技公司申请微信支付被拒绝? 4798
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9047