flat: 地图修改

This commit is contained in:
Apcallover
2024-06-11 10:10:29 +08:00
parent 4dce135e0d
commit d19b4d502b
15 changed files with 1564 additions and 42 deletions

View File

@@ -89,6 +89,11 @@
type: Boolean,
required: false,
default: false,
},
init: {
type: Boolean,
required: false,
default: true,
}
},
data() {
@@ -109,13 +114,20 @@
};
},
mounted() {
this.initMap()
if (this.flagTip) {
this.createHelpTooltip()
if (this.init) {
this.initMap()
}
},
methods: {
initMap() {
initMap(options) {
let lat, lon;
if (options) {
lat = options.lat
lon = options.lon
} else {
lat = this.latitude
lon = this.longitude
}
this.map = new Map({
target: 'map',
controls: control.defaults({
@@ -132,7 +144,7 @@
}),
],
view: new View({
center: [this.longitude, this.latitude],
center: [lon, lat],
maxZoom: this.maxZoom,
minZoom: this.minZoom,
zoom: this.zoom,
@@ -170,8 +182,8 @@
if (this.open) {
this.addFeature([{
id: 1,
latitude: this.latitude,
longitude: this.longitude,
latitude: lat,
longitude: lon,
iconPath: mypoint,
title: '我的位置',
width: 20,
@@ -179,12 +191,17 @@
}])
}
if (this.flagTip) {
this.createHelpTooltip()
}
},
addMarker(point) {
console.log('point', point)
// this.ceateMarker([104.404419, 31.133980])
},
addFeature(covers) {
console.log(covers)
const features = covers.map((item) => ({
type: 'Feature',
geometry: {