提交 36c9f216 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix(h5 openLocation): 腾讯、高德导航未自动获取当前位置问题 (question/155066)

上级 b05699cc
......@@ -141,17 +141,15 @@ export default {
url = `https://www.google.com/maps/dir/?api=1${origin}&destination=${this.latitude}%2C${this.longitude}`
} else if (mapInfo.type === MapType.QQ) {
const fromcoord = this.location.latitude
? `&fromcoord=${this.location.latitude}%2C${this.location.longitude}`
? `&fromcoord=${this.location.latitude}%2C${this.location.longitude}&from=${encodeURIComponent(
'我的位置'
)}`
: ''
url = `https://apis.map.qq.com/uri/v1/routeplan?type=drive${fromcoord}&tocoord=${this.latitude
}%2C${this.longitude}&from=${encodeURIComponent(
'我的位置'
)}&to=${encodeURIComponent(this.name || '目的地')}&ref=${mapInfo.key}`
}%2C${this.longitude}&to=${encodeURIComponent(this.name || '目的地')}&ref=${mapInfo.key}`
} else if (mapInfo.type === MapType.AMAP) {
url = `https://m.amap.com/navi/?dest=${this.longitude},${this.latitude}&key=${mapInfo.key}`
if (this.name) {
url += `&destName=${this.name}`
}
const from = this.location.latitude ? `from=${this.location.longitude},${this.location.latitude},${encodeURIComponent('我的位置')}&` : ''
url = `https://uri.amap.com/navigation?${from}to=${this.longitude},${this.latitude},${encodeURIComponent(this.name || '目的地')}}`
}
window.open(url)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册