小程序-page给组件传递事件( page调用组件中的方法 )
1 //子组件中 2 Component({ 3 methods:{ 4 addInterval:function(){ 5 ..... 6 } 7 } 8 }) 9 //page中 10 //在wxml中引用组件时候,给组件得到属性加上 id=mycircle 11 //在js中,可以传递调用事件 12 this.selectComponent("#mycircle).addInterval();
1 //子组件中 2 Component({ 3 methods:{ 4 addInterval:function(){ 5 ..... 6 } 7 } 8 }) 9 //page中 10 //在wxml中引用组件时候,给组件得到属性加上 id=mycircle 11 //在js中,可以传递调用事件 12 this.selectComponent("#mycircle).addInterval();