微信小程序selectComponent获取自定义子组件

1、微信小程序中父组件获取子组件对象方法javascript

1.selectComponent,返回选择器的第一个组件java

2.selectAllComponents,返回选择器的组件列表小程序

参数为选择器。微信小程序

使用示例:微信

//根据ID获取组件对象
    var showTwo = this.selectComponent('#myShow');
    //访问属性,使用data访问内部属性和组件属性
    console.info(showTwo.data);
    //执行操做
    showTwo.innerAdd();

    //根据样式获取,建议使用selectAllComponents
    var showThree = this.selectComponent('.myShow');
    console.info(showThree.data);
    showThree.innerAdd();

 

更多:this

微信小程序组件间通讯(二)spa

微信小程序组件间通讯(一).net

小程序中的小数计算问题/浮点数计算问题code

相关文章
相关标签/搜索