地图
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import {mapState} from 'vuex'
|
||||
import {mapActions, mapState} from 'vuex'
|
||||
export default {
|
||||
name: "AiTMap",
|
||||
props: {
|
||||
@@ -52,38 +52,38 @@ export default {
|
||||
document.body.appendChild(script);
|
||||
},
|
||||
initTMap() {
|
||||
var latLng = {}
|
||||
if(this.config.lat) { //通用版
|
||||
latLng = this.config
|
||||
this.mapLib = TMap
|
||||
this.tmap = new TMap.Map(this.$refs.tmap, {
|
||||
zoom: 11,
|
||||
center: new TMap.LatLng(latLng.lat, latLng.lng),
|
||||
...this.ops
|
||||
})
|
||||
this.$emit('loaded')
|
||||
this.$emit('update:lib', TMap)
|
||||
this.$emit('update:map', this.tmap)
|
||||
this.areaId && this.getMapArea()
|
||||
}else { //上架版
|
||||
// var latLng = {}
|
||||
// if(this.config.lat) { //通用版
|
||||
// latLng = this.config
|
||||
// this.mapLib = TMap
|
||||
// this.tmap = new TMap.Map(this.$refs.tmap, {
|
||||
// zoom: 11,
|
||||
// center: new TMap.LatLng(latLng.lat, latLng.lng),
|
||||
// ...this.ops
|
||||
// })
|
||||
// this.$emit('loaded')
|
||||
// this.$emit('update:lib', TMap)
|
||||
// this.$emit('update:map', this.tmap)
|
||||
// this.areaId && this.getMapArea()
|
||||
// }else { //上架版
|
||||
|
||||
this.wxInvoke(['getLocation', {
|
||||
}, (res) => {
|
||||
latLng = {
|
||||
lat: res.latitude,
|
||||
lng: res.longitude
|
||||
}
|
||||
this.mapLib = TMap
|
||||
this.tmap = new TMap.Map(this.$refs.tmap, {
|
||||
zoom: 11,
|
||||
center: new TMap.LatLng(latLng.lat, latLng.lng),
|
||||
...this.ops
|
||||
})
|
||||
this.$emit('loaded')
|
||||
this.$emit('update:lib', TMap)
|
||||
this.$emit('update:map', this.tmap)
|
||||
this.areaId && this.getMapArea()
|
||||
}])
|
||||
// this.wxInvoke(['getLocation', {
|
||||
// }, (res) => {
|
||||
// latLng = {
|
||||
// lat: res.latitude,
|
||||
// lng: res.longitude
|
||||
// }
|
||||
// this.mapLib = TMap
|
||||
// this.tmap = new TMap.Map(this.$refs.tmap, {
|
||||
// zoom: 11,
|
||||
// center: new TMap.LatLng(latLng.lat, latLng.lng),
|
||||
// ...this.ops
|
||||
// })
|
||||
// this.$emit('loaded')
|
||||
// this.$emit('update:lib', TMap)
|
||||
// this.$emit('update:map', this.tmap)
|
||||
// this.areaId && this.getMapArea()
|
||||
// }])
|
||||
|
||||
// wx.getLocation({
|
||||
// type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
||||
@@ -95,8 +95,14 @@ export default {
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
this.tmap = new TMap.Map(this.$refs.tmap, {
|
||||
zoom: 11,
|
||||
...this.ops
|
||||
})
|
||||
this.$emit('loaded')
|
||||
this.$emit('update:lib', TMap)
|
||||
this.$emit('update:map', this.tmap)
|
||||
this.areaId && this.getMapArea()
|
||||
|
||||
},
|
||||
fitBounds(latLngList, count = 0) {
|
||||
|
||||
Reference in New Issue
Block a user