有时候父组件需要直接调用子组件的方法
<!-- 父组件引用子组件son -->
<template>
<div>
<div>
<button @click='refreshBtn'>刷新son数据</button>
</div>
<son ref="son">
</son>
</div>
</template>
<script>
methods: {
refreshBtn() {
// 父直接调用子组件的refresh方法
this.$refs.son.refresh()
},
}
</script>