Vue AMap Component Library

0.5.10 · abandoned · verified Sun Apr 19

Vue AMap (vue-amap) is a component library designed for Vue 2.0 applications, providing an abstraction layer for the Gaode (Amap) Map JavaScript API. It enables declarative rendering of various map elements such as markers, polylines, polygons, circles, info windows, and more, leveraging Vue's reactivity system. The current stable version is 0.5.10. This package specifically targets the Vue 2 ecosystem and integrates with the Gaode Maps service, which is primarily used in China. The project appears to have ceased active development and maintenance, making it suitable mainly for legacy Vue 2 applications already using Gaode Maps.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install, initialize, and integrate vue-amap into a Vue 2 application. It shows global registration, loading the AMap API with a key and plugins, and rendering a basic map with a marker.

import Vue from 'vue';
import VueAMap from 'vue-amap';

Vue.use(VueAMap);

// Initialize vue-amap, load the Gaode Map SDK
VueAMap.initAMapApiLoader({
  key: 'YOUR_GAODE_KEY_HERE', // Replace with your actual Gaode Map key
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.ToolBar'],
  v: '1.4.4' // Specify Gaode SDK version
});

new Vue({
  el: '#app',
  data() {
    return {
      zoom: 12,
      center: [116.397428, 39.90923],
      markers: [{ position: [116.397428, 39.90923] }]
    };
  },
  template: `
    <div style="width: 800px; height: 600px;">
      <el-amap :zoom="zoom" :center="center">
        <el-amap-marker v-for="(marker, index) in markers" :key="index" :position="marker.position"></el-amap-marker>
      </el-amap>
    </div>
  `
});

view raw JSON →