当前位置: 首页 > news >正文

vue接入高德地图

使用 JSAPI 安全模式,代理服务请以_AMapService 作为一级路由

index.html

  <script type="text/javascript">window._AMapSecurityConfig = {serviceHost: "http://xx.xx.xx.xx:8223/_AMapService"};</script><script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=你的高德key"></script>

nginx配置

	# 前端服务server {listen       8223;server_name  8223;charset utf-8;location / {root   /root/qianduan/前端代码;try_files $uri $uri/ /index.html;index  index.html index.htm;add_header Access-Control-Allow-Origin *;}location /_AMapService/v4/map/styles {set $args "$args&jscode=你自己的安全密钥";proxy_pass http://webapi.amap.com/v4/map/styles;}# 海外地图服务代理location /_AMapService/v3/vectormap {set $args "$args&jscode=你自己的安全密钥";proxy_pass http://fmap01.amap.com/v3/vectormap;}# Web服务API 代理location /_AMapService/ {set $args "$args&jscode=你自己的安全密钥";proxy_pass http://restapi.amap.com/;}}

使用

	new AMap.Map('mapContainer', {zoom: 10,center: [108.931284, 34.382289]})
http://www.lryc.cn/news/275143.html

相关文章:

  • Linux的基本指令(5)
  • 华为商城秒杀时加密验证 device_data 的算法研究
  • Wrk压测发送Post请求的正确姿势
  • 【管理篇 / 登录】❀ 06. macOS下使用USB配置线登录 ❀ FortiGate 防火墙
  • linux系统shell语言的自动化交互
  • HarmonyOS ArkTS 三方库的基本使用(十六)
  • Spring boot封装rocket mq 教程
  • Java Swing手搓童年坦克大战游戏(I)
  • 【DevOps-04]】Operate阶段工具
  • 力扣2807.在链表中插入最大公约数
  • 开始刷Leetcode之前你需要知道的 - The basic is all you need
  • 【PostgreSQL】模式Schema
  • JavaScript实现的复杂功能:自动生成带水印的图片
  • 图神经网络|8.2 图卷积的计算基本方法
  • equals()与hashCode()方法详解
  • 六、基于Flask、Flasgger、marshmallow的开发调试
  • TypeScript 从入门到进阶之基础篇(三) 元组类型篇
  • 现代CPU的多种运行模式
  • Python PDF处理模块pypdf库详解
  • C++上位软件通过LibModbus开源库和西门子S7-1200/S7-1500/S7-200 PLC进行ModbusTcp 和ModbusRTU 通信
  • PLSQL Developer 15安装和oracle客户端安装
  • 【深度deepin】深度安装,jdk,tomcat,Nginx安装
  • 解决flask启动报错:ImportError: DLL load failed while importing _dukpy: 找不到指定的程序
  • 腾讯面试总结
  • 面向对象进阶(static关键字,继承,方法重写,super,this)
  • Blazor项目如何调用js文件
  • Windows11 - Ubuntu 双系统及 ROS、ROS2 安装
  • 深度学习(学习记录)
  • html5实现好看的个人博客模板源码
  • SpringSecurity深度学习