vue組件復用同一實例 vue父組件中調用子組件函數(shù)的方法?
vue父組件中調用子組件函數(shù)的方法?<!--編輯成員--><edituser ref=“edituser”v-on:childmethod=“parentmethod”></edi
vue父組件中調用子組件函數(shù)的方法?
<!--編輯成員--><edituser ref=“edituser”v-on:childmethod=“parentmethod”></edituser>12<script>import edituser from”/編輯.vue導出默認值{data(){return{}},方法:{parentMethod(param){控制臺.log(“parent”)},}}</script>
使用$emit觸發(fā)父組件的事件,父組件將偵聽此事件。使用此$父.xxxx這樣,就可以直接調用父組件的方法。