地图中心定位
This commit is contained in:
@@ -51,10 +51,26 @@ export default {
|
|||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
},
|
},
|
||||||
initTMap() {
|
initTMap() {
|
||||||
|
var latLng = {}
|
||||||
|
if(this.config.lat) { //通用版
|
||||||
|
latLng = this.config
|
||||||
|
}else { //上架版
|
||||||
|
wx.getLocation({
|
||||||
|
type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
latLng = {
|
||||||
|
lat: res.latitude,
|
||||||
|
lng: res.longitude
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
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,
|
||||||
// center: new TMap.LatLng(this.config.lat, this.config.lng),
|
center: new TMap.LatLng(latLng.lat, latLng.lng),
|
||||||
...this.ops
|
...this.ops
|
||||||
})
|
})
|
||||||
this.$emit('loaded')
|
this.$emit('loaded')
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ uni-page-body {
|
|||||||
.AppHealthUp {
|
.AppHealthUp {
|
||||||
|
|
||||||
.emptyWrap {
|
.emptyWrap {
|
||||||
background: #f5f5f5;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
::v-deep .emptyText{
|
::v-deep .emptyText{
|
||||||
|
|||||||
Reference in New Issue
Block a user