|
@@ -11,7 +11,7 @@
|
|
|
<BasicForm @register="registerForm">
|
|
|
<template #map>
|
|
|
<!-- <Card style="width: 300px; height: 300px"> -->
|
|
|
- <div ref="wrapRef" style="width: 600px; height: 400px"></div>
|
|
|
+ <div ref="wrapRef" style="width: 100%; height: 400px"></div>
|
|
|
<!-- </Card> -->
|
|
|
</template>
|
|
|
</BasicForm>
|
|
@@ -19,7 +19,7 @@
|
|
|
</BasicDrawer>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
- import { defineComponent, ref, computed, unref, nextTick, onMounted } from 'vue';
|
|
|
+ import { defineComponent, ref, computed, unref, nextTick, onMounted, reactive } from 'vue';
|
|
|
import { BasicForm, useForm, FormSchema } from '/@/components/Form/index';
|
|
|
// import { Card } from 'ant-design-vue';
|
|
|
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
|
@@ -31,8 +31,8 @@
|
|
|
import { data as CascaderData } from '/@/utils/cascaderData';
|
|
|
|
|
|
import { useScript } from '/@/hooks/web/useScript';
|
|
|
-
|
|
|
- const A_MAP_URL = 'https://webapi.amap.com/maps?v=2.0&key=5a2d384532ae531bf99bd8487c4f03d2';
|
|
|
+ const A_MAP_URL = 'https://webapi.amap.com/maps?v=2.0&key=e661b00bdf2c44cccf71ef6070ef41b8';
|
|
|
+ // const A_MAP_URL = 'https://webapi.amap.com/maps?v=2.0&key=5a2d384532ae531bf99bd8487c4f03d2';
|
|
|
// const A_MAP_URL = 'https://webapi.amap.com/maps?v=1.4.10&key=e661b00bdf2c44cccf71ef6070ef41b8';
|
|
|
|
|
|
//webapi.amap.com/maps?v=1.4.10&key=e661b00bdf2c44cccf71ef6070ef41b8
|
|
@@ -45,6 +45,11 @@
|
|
|
setup() {
|
|
|
const isUpdate = ref(true);
|
|
|
const wrapRef = ref<HTMLDivElement | null>(null);
|
|
|
+ const defaultAddress = reactive({
|
|
|
+ address: '山阴路688号恒隆广场B座1217',
|
|
|
+ longt: '山阴路688号恒隆广场B座1217',
|
|
|
+ });
|
|
|
+ console.log('defaultAddress', defaultAddress);
|
|
|
const { toPromise } = useScript({ src: A_MAP_URL });
|
|
|
|
|
|
const { t } = useI18n();
|
|
@@ -177,13 +182,31 @@
|
|
|
const AMap = (window as any).AMap;
|
|
|
console.log('AMap', AMap);
|
|
|
// center: [this.longitude || 120.262337, this.latitude || 30.178285],
|
|
|
+ // const geocoder = new AMap.Geocoder({});
|
|
|
const map = new AMap.Map(wrapEl, {
|
|
|
- zoom: 30,
|
|
|
+ zoom: 18,
|
|
|
center: [120.262337, 30.178285],
|
|
|
viewMode: '3D',
|
|
|
+ resizeEnable: true,
|
|
|
+ floorControl: true,
|
|
|
+ showIndoorMap: true,
|
|
|
});
|
|
|
+ AMap.plugin('AMap.Geocoder', function () {
|
|
|
+ var geocoder = new AMap.Geocoder({
|
|
|
+ // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
|
|
|
+ city: '010',
|
|
|
+ });
|
|
|
+
|
|
|
+ geocoder.getLocation('北京市海淀区苏州街', function (status, result) {
|
|
|
+ if (status === 'complete' && result.info === 'OK') {
|
|
|
+ // result中对应详细地理坐标信息
|
|
|
+ console.log('result', result);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
const marker = new AMap.Marker({
|
|
|
- position: new AMap.LngLat(120.262337, 30.178285), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
|
|
|
+ position: new AMap.LngLat(120.262337, 30.178285),
|
|
|
title: 'lala',
|
|
|
});
|
|
|
map.add(marker);
|