// 引入高德地图JSAPI(请确保已经在项目中引入了高德地图JSAPI) const AMap = require('@amap-jsapi-biz/src/amap-wx'); export default { data() { return { // 假设这是从天地图获取的坐标点 tianDiTuCoord: [116.397428, 39.90923], // 天地图坐标点, 经度, 纬度 }; }, methods: { convertCoord() { // 初始化高德地图JSAPI new AMap.AMapWX({ key: '你的高德地图Web服务API Key', // 替换为你的高德地图Web服务API Key }); // 调用坐标转换服务 AMap.convertFrom({ coordType: 'wgs84', // 坐标类型,可选值:'gcj02', 'bd09', 'bd09ll', 'wgs84', 'google', 'sogou', 'mapbar', 'geocoder', 'auto', 'mars', 'openstreetmap', 'tianjd' locations: this.tianDiTuCoord, // 待转换坐标数组 }).then((data) => { // 转换成功,data.locations为转换后的坐标数组 console.log('转换后的坐标:', data.locations); }).catch((err) => { // 转换失败的处理逻辑 console.error('坐标转换失败:', err); }); }, }, onLoad() { this.convertCoord(); }, };