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

小程序 文章 2020-08-11 18:01 790 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群

相关文章
请问下 腾迅文档小程序 公众号文章是怎么实现 点右上角三个点可以在腾讯文档中打开和保存公众号文章?
密码忘了怎么办?
创建直播间的时候能默认开启“直播回放”这个功能吗?
小程序推送消息功能入参formId不传可以吗?
小程序注册一直等待是什么原因?
随便看看
怎么添加小程序支付功能? 4516
教育科技公司申请微信支付被拒绝? 4798
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9048
如何快速搭建抽奖助手小程序(无需代码知识) 6177
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7472
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 6793