Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
map-demo
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-03-06 12:51:53 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
161c8b973feb7a09f553f45b4667918a278a22ea
161c8b97
1 parent
bde36ff8
fix 完善步行导航功能-可以关闭导航,自动定位到当前位置
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletions
src/views/by/map.vue
src/views/by/map.vue
View file @
161c8b9
<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-06 12:
14:54
* @LastEditTime: 2025-03-06 12:
47:35
* @FilePath: /map-demo/src/views/by/map.vue
* @Description: 公众地图主体页面
-->
...
...
@@ -55,6 +55,12 @@
关闭步行导航
</div>
<!-- 新增关闭导航按钮 -->
<div v-if="walking && !show_walk_route" class="walk-nav-text" @click="closeWalkingRoute">
关闭步行导航
</div>
<van-dialog v-model:show="dialog_show" title="温馨提示">
<div style="padding: 1rem; text-align: center;">{{ dialog_text }}</div>
</van-dialog>
...
...
@@ -1021,6 +1027,11 @@ export default {
this.walking.search(start, end, (status, result) => {
if (status === 'complete') {
console.log('步行路线规划成功');
setTimeout(() =>{
// 定位到当前位置中心
this.getLocation();
this.show_walk_route = false;
},500)
} else {
console.error('步行路线规划失败:', status, result);
ElMessage.error('步行路线规划失败,请稍后重试');
...
...
@@ -1043,6 +1054,21 @@ export default {
this.current_lat = '';
this.map.remove(this.location_marker); // 删除当前定位标记
},
closeWalkingRoute() {
if (this.walking) {
this.walking.clear(); // 清除路线
this.show_walk_route = true; // 恢复状态
// 可选:移除面板内容
document.getElementById('walking-panel').innerHTML = '';
// 显示提示
this.show_toast = true;
this.toast_text = '已关闭步行导航';
// 可选:重新定位到当前位置
this.getLocation();
}
},
}
}
</script>
...
...
Please
register
or
login
to post a comment