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