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

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

相关文章
小标居中,可是发表以后在手机上,没有居中,可以修改吗?后台是不是可以帮助?
你好,你所申请的应用名称与所提供官网信息不一致,建议提供包含应用名称及介绍的有效官网业务重新提审?
商户私钥获取
开放平台一进入第三方平台就提示错误是为什么呢?
微信人脸识别接口失败?
随便看看
教育科技公司申请微信支付被拒绝? 3851
微信公众号免300认证教程 4947
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 4065
小程序广告组件通过审核,但是小程序内没有显示广告? 4145
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8010
问题? 7243
如何快速搭建抽奖助手小程序(无需代码知识) 5030
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 5982
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5504
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5200