父页面向自定义组件中传递动态变量值?

小程序 文章 2020-09-03 11:01 534 0 全屏看文

AI助手支持GPT4.0

父页面向自定义组件中传递动态变量值?Does the parent page pass dynamic variable values ​​to custom components?

父页面向自定义组件中传递动态变量值?

现在有一个问题,就是有个页面当中使用了 标签,标签中使用了自定义的组件,现在想把每次滑动的页面ID ,传递到这个组件中去。后台的item数据,传递过去我在组件中都能接收到,就是这个滑动的页面ID 我传递不过去。写法我感觉是没错的。但不知道哪的原因获取不到。

下面的treeList 是后台的item数据可以接收到的,上面的那个就是页面ID ,接收不到,是组件不接受多个参数这样吗?

这个是父页面用组件的写法,我感觉没有什么错? 求各位大佬指点一下。实在不知道哪里出问题

Now there is a problem, that is, a page uses a tag and a custom component is used in the tag. Now I want to transfer the page ID of each slide to this component. The item data in the background can be received in the components after passing, but I can't pass the sliding page ID. I feel that the writing method is correct. But I don't know where to get it. The following treelist is the item data that can be received in the background. The one above is the page ID. if not, the component does not accept multiple parameters? This is the way to write the parent page with components. I don't think there is anything wrong with it? Please give me some advice. I don't know what went wrong

回答:

丶晓晓晓包:

传给子组件的数据不支持驼峰吧,tree-list,current-tab-num

仙ღ₅₂₀¹³¹⁴:


properties: { treeList: {  type: Object,  value: {} }}
安静:不是这种接收不到,LIST是可以的,是每次传过来的tab接收不到
仙ღ₅₂₀¹³¹⁴:你在currentTabNum的observer里 打印下 val 就知道了
安静:这个是每次都随着滑动有变化的,也就是有值的。但是要把这个值this.setData到data 里面是改变不了的。也就是说虽然在observer这个里面有val,但是我实际用不了
安静:
安静:就是页面的数字ID , 0和1这种

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
如何循环出数组中之地当的某一条数据?
小程序后端签名成功 前端调起支付,为什么一直提示签名失败?直接崩溃到晚上3点,求大佬指导!呜呜。
web-view wx.miniProgram.navigateTo,一直没反应也没报错是什么?
js接收数值在前端渲染会变?
能不能在用户点击小程序图标时,就监控到用户这个使用的行为?
随便看看
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8420
问题? 7637
如何快速搭建抽奖助手小程序(无需代码知识) 5202
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 6469
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5774
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5434
如何解决渲染层网络错误Failed to load media? 16683
小程序找号找回 释放昵称? 2721
我的小程序广告主收入5301,实际进账4406,是怎么回事呀? 2592
删除部分微信用户个人数据的通知,怎么删除? 5655