組件 js:
var value = 123; this.triggerEvent('callSomeFun', value)
父組件 wxml:
<component bind:callSomeFun="onLoad"></component>
父組件 js :
onLoad: function() { ... ... }
父組件調用子組件的方法
當父組件引用了子組件的時候,會遇到父組件執行子組件的方法
父組件中
wxml: <filter-cmp id='filter-cmp' bind:filterTriger='filterTriger'></filter-cmp>
js: this.selectComponent('#filter-cmp').restFilterDatas();
子組件中: 定義方法 restFilterDatas