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

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

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