变量闭环
This commit is contained in:
@@ -65,6 +65,7 @@ export default {
|
|||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
},
|
},
|
||||||
initTMap() {
|
initTMap() {
|
||||||
|
const TMap = window?.TMap
|
||||||
this.mapLib = TMap
|
this.mapLib = TMap
|
||||||
this.tmap = new TMap.Map(this.$refs.tmap, {
|
this.tmap = new TMap.Map(this.$refs.tmap, {
|
||||||
zoom: 11,
|
zoom: 11,
|
||||||
@@ -76,7 +77,7 @@ export default {
|
|||||||
this.areaId && this.getMapArea()
|
this.areaId && this.getMapArea()
|
||||||
},
|
},
|
||||||
getMapArea() {
|
getMapArea() {
|
||||||
let {mapLib, areaId, tmap: map} = this, keyword = areaId.substring(0, 6)
|
let {mapLib: TMap, areaId, tmap: map} = this, keyword = areaId.substring(0, 6)
|
||||||
const fitBounds = (latLngList) => {
|
const fitBounds = (latLngList) => {
|
||||||
// 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围
|
// 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围
|
||||||
if (latLngList.length === 0) {
|
if (latLngList.length === 0) {
|
||||||
@@ -98,7 +99,7 @@ export default {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
let polygons = new TMap.MultiPolygon({map, geometries: []});
|
let polygons = new TMap.MultiPolygon({map, geometries: []});
|
||||||
new mapLib.service.District({
|
new TMap.service.District({
|
||||||
polygon: 2,
|
polygon: 2,
|
||||||
maxOffset: 100
|
maxOffset: 100
|
||||||
}).search({keyword}).then(res => {
|
}).search({keyword}).then(res => {
|
||||||
|
|||||||
Reference in New Issue
Block a user