微信小程序自定义组件:获取子组件实例对象,直接访问组件的任意数据和方法
前言
略
获取子组件实例对象
wxml
<myChildrenComponent id="mychildrenComponentId"
>
myChildrenComponent>
js
let childrenComponent = this.selectComponent("#mychildrenComponentId")
访问组件方法
childrenComponent.fun1();
访问组件数据
childrenComponent.data.prop1
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
