假設父組件里有這么一個方法
methods{ async getMessageList(message_category_id){ console.log(message_category_id) } }
在父組件引用子組件時綁定該方法
<unio2o-category-child-list v-on:pgetMessageList="getMessageList"></unio2o-category-child-list> //注意綁定參數
在子組件中假如需要觸發父組件中的方法,舉例(代碼舉一反三):
//當前處於子組件 methods{ testFunc(){ this. getMessageList(12234) }, getMessageList(message_category_id){ this.$emit("pgetMessageList",message_category_id) //第二個參數表示要傳遞的參數值,第二個參數可以沒有 }, }