使用 $refs
在 Vue 3 中,你可以使用 ref 属性在模板中注册一个子组件的引用。然后,在父组件中,你可以通过 this.$refs 访问这个子组件实例,并调用其方法。
父组件
<template>
<section class="dataList">
<provincesDataList ref="provincesDataRef"/>
</section>
</template
使用 $refs
在 Vue 3 中,你可以使用 ref 属性在模板中注册一个子组件的引用。然后,在父组件中,你可以通过 this.$refs 访问这个子组件实例,并调用其方法。
父组件
<template>
<section class="dataList">
<provincesDataList ref="provincesDataRef"/>
</section>
</template