需要下载
npm i @amap/amap-jsapi-loader --save
<template>
<div>
<div id="map"></div>
</div>
</template>
<script setup lang="ts">
import AMapLoader from "@amap/amap-jsapi-loader";
import hotdata from "./hotData"; //这个是热力图的数据
import { ref } from "vue";
const heatmap = ref<any>(null);
AMapLoader.load({
key: "自己的key",
version: "2.0",
plugins: ["AMap.HeatMap"],
}).then((AMap) => {
var map;//这里面map一定要是var map=null,否则会报错的
map = new AMap.Map("map", {
viewMode: "3D",//这个模式取决于热力图是否为3D
pitch: 70,
resizeEna