flat: 街道添加地图
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="app-content">
|
||||
<el-input
|
||||
v-if="type !== 'view'"
|
||||
v-if="showInput"
|
||||
:placeholder="placeholder"
|
||||
clearable
|
||||
v-model="addressLocation"
|
||||
@@ -52,7 +52,7 @@ import {
|
||||
GetFeaturesByGeometryParameters
|
||||
} from '@supermap/iclient-ol';
|
||||
|
||||
console.log(process.env.VUE_APP_SUPPER_MAP)
|
||||
const geoJSONParser = new GeoJSON();
|
||||
export default {
|
||||
name: "uMapView",
|
||||
props: {
|
||||
@@ -114,6 +114,14 @@ export default {
|
||||
default: 'custom',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showInput() {
|
||||
if (this.type === 'view' || this.type === 'select') {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 实例化对象
|
||||
@@ -281,6 +289,13 @@ export default {
|
||||
careateFeature(result) {
|
||||
if (this.vectorSourceIcon) {
|
||||
this.vectorSourceIcon.clear()
|
||||
const geojsonObject = {
|
||||
type: 'FeatureCollection',
|
||||
features: result,
|
||||
};
|
||||
this.vectorSourceIcon.addFeatures(geoJSONParser.readFeatures(geojsonObject))
|
||||
this.vectorSourceIcon.changed()
|
||||
return
|
||||
}
|
||||
const geojsonObject = {
|
||||
type: 'FeatureCollection',
|
||||
@@ -288,7 +303,7 @@ export default {
|
||||
};
|
||||
// 创建一个图层作为点位
|
||||
this.vectorSourceIcon = new SourceVector({
|
||||
features: new GeoJSON().readFeatures(geojsonObject)
|
||||
features: geoJSONParser.readFeatures(geojsonObject)
|
||||
});
|
||||
this.vectorLayerIcon = new LayerVector({
|
||||
source: this.vectorSourceIcon,
|
||||
|
||||
Reference in New Issue
Block a user