vue-amap与高德原生sdk一起使用时,需要在index.html
里面引入原生sdk
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<script type="text/javascript"
src="https://webapi.amap.com/maps?v=1.4.15&key=yourkey"></script>
<link rel="stylesheet" href="https://at.alicdn.com/t/font_2704084_4qs6i7c5kf7.css">
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
示例
<template>
<div id="container">
<el-amap vid="amap" :amapManager="amapManager" :events="mapEvents">
<el-amap-marker
v-for="(marker, index) in markers"
:icon="icon"
:position="marker.position"
:key="index"
:events="marker.events"
:title="marker.name"
:label="marker.label"
:offset="[-15, -30]"
/>
</el-amap>
<div class="title">华新项目管理大屏</div>
<div class="switch-wrapper active" id="switch" @click="switchMap">
<i class="iconfont icon-astronomical-full"></i>
<span class="sate-text">卫星</span>
</div>
</div>
</template>
<script>
import axios from "./utils/request";
import {
AMapManager }