组件 custom-component
Component({ methods: { sayHello() { console.log('hello'); }, }, });
页面调用组件方法
<custom-component id="custom-component"></custom-component>
// 获取组件实例对象,并调用子组件方法 this.selectComponent('#custom-component').sayHello();
组件 custom-component
Component({ methods: { sayHello() { console.log('hello'); }, }, });
页面调用组件方法
<custom-component id="custom-component"></custom-component>
// 获取组件实例对象,并调用子组件方法 this.selectComponent('#custom-component').sayHello();