在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:vue-amap开源软件地址:https://gitee.com/guyangyang/vue-amap开源软件介绍:@vuemap/vue-amap文档
觉得有用可以给个star 群号捐赠支持安装npm i -S @vuemap/vue-amap@next 快速上手引入@vuemap/vue-amap@next // 引入vue-amapimport VueAMap, {initAMapApiLoader} from '@vuemap/vue-amap';import '@vuemap/vue-amap/dist/style.css';// 初始化vue-amapinitAMapApiLoader({ // 高德的key key: 'YOUR_KEY',});createApp(App).use(VueAmap) 自动导入首先你需要安装 npm install -D unplugin-vue-components unplugin-auto-import @vuemap/unplugin-resolver 然后在main.ts中导入css和进行初始化key import App from './App.vue'import {initAMapApiLoader} from '@vuemap/vue-amap';import '@vuemap/vue-amap/dist/style.css'initAMapApiLoader({ key: 'YOUR_KEY'})createApp(App) .mount('#app') 再修改配置文件,把下列代码插入到你的 Vite 或 Webpack 的配置文件中 import { defineConfig } from 'vite'import vue from '@vitejs/plugin-vue'import AutoImport from 'unplugin-auto-import/vite'import Components from 'unplugin-vue-components/vite'import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'import {VueAmapResolver} from '@vuemap/unplugin-resolver'// https://vitejs.dev/config/export default defineConfig({ plugins: [ vue(), AutoImport({ resolvers: [VueAmapResolver()], }), Components({ resolvers: [VueAmapResolver()], }), ]}) 组件地图<el-amap :zoom="zoom" :center="center"></el-amap> |
请发表评论