Ts加vue3的ref引用 用户23221011707 2025-06-11 35 阅读1分钟 // 定义接口类型 interface PointsInstance { refreshMap: () => void; } const mapComponent = ref<PointsInstance | null>(null); //更新地图标点 const refreshMap=()=>{ // 外部调用示例 if (mapComponent.value) { mapComponent.value.refreshMap(); // 通过ref调用子组件的方法 } }