vue+ts $refs 问题
问题:
this.$refs.districtMap.previewHotel(this.newHotel)
报错:
Property 'previewHotel' does not exist on type 'Element | Element[] | Vue | Vue[]'.
Property 'previewHotel' does not exist on type 'Element'.
解决:
(this.$refs.districtMap as Vue & {previewHotel:Function}).previewHotel(this.newHotel)
原因:
TS类型