hookehuyr

fix

<!--
* @Date: 2023-05-19 14:54:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-07-11 15:02:28
* @LastEditTime: 2024-07-11 18:27:35
* @FilePath: /map-demo/src/views/tools.vue
* @Description: 公众地图主体页面
-->
......@@ -9,14 +9,16 @@
<div ref="root" style="height: 100vh; position: relative; overflow: hidden;">
<div id="container"></div>
<div style="position: fixed; display: flex;background-color: #FFF; align-items: center; padding: 0.5rem 1rem;">
<van-field v-model="filter_lng" label="经度" placeholder="请输入经度" />
<van-field v-model="filter_lat" label="纬度" placeholder="请输入纬度" />
<van-field v-model="filter_lng" label="经度" placeholder="请输入经度" style="width: 20rem;" />
<van-field v-model="filter_lat" label="纬度" placeholder="请输入纬度" style="width: 20rem;" />
<van-button @click="handleQuery" type="primary" block size="small" style="width: 10rem;">快速定位</van-button>
<van-button @click="queryLngLat" type="warning" block size="small" style="width: 10rem; margin-left: 1rem;">坐标查询</van-button>
<van-button @click="setRotation(-10)" type="default" block size="small" style="width: 10rem; margin-left: 1rem;">旋转-10</van-button>
<van-button @click="setRotation(10)" type="default" block size="small" style="width: 10rem; margin-left: 1rem;">旋转+10</van-button>
<div style="font-size: 0.9rem; padding: 0 0.85rem;">当前度数 {{ data_rotation }}</div>
<van-button @click="setRotationMinus()" type="default" block size="small" style="width: 10rem; margin-left: 1rem;">旋转-10</van-button>
<van-button @click="setRotationPlus()" type="default" block size="small" style="width: 10rem; margin-left: 1rem;">旋转+10</van-button>
&nbsp;设置<van-field v-model="data_rotation" label="" placeholder="请输入旋转值" style="width: 3.5rem;" @blur="setRotation()" />度
</div>
<div v-if="log_lnglat" style="position: fixed; top: 5rem; left: 1rem; color: white;">
<div v-if="log_lnglat" style="position: fixed; top: 5rem; left: 1rem; color: black;">
<div style="display: flex;">点击经纬度:{{ log_lnglat }}</div>
</div>
<!-- <div class="nav-bar-wrapper">
......@@ -258,6 +260,7 @@ export default {
data_zooms: '', // 接口获取-地图默认缩放范围
data_rotation: 0, // 接口获取-地图旋转角度
log_lnglat: '', // 获取当前地址经纬度
temp_rotation: 0
}
},
async mounted() {
......@@ -1201,9 +1204,27 @@ export default {
queryLngLat () {
window.open('https://lbs.amap.com/tools/picker')
},
setRotation (deg) {
this.data_rotation = this.data_rotation + deg;
setRotationMinus () {
this.data_rotation = +this.data_rotation - 10;
// if (this.data_rotation === 0) {
// this.map.setRotation(-10);
// this.data_rotation = -10
// } else {
// }
this.map.setRotation(this.data_rotation);
// if (this.data_rotation <= 0) {
// this.data_rotation = 0;
// }
},
setRotationPlus () {
this.data_rotation = +this.data_rotation + 10;
// if (this.data_rotation >= 360) {
// this.data_rotation = 360;
// }
this.map.setRotation(this.data_rotation);
},
setRotation () {
this.map.setRotation(+this.data_rotation);
}
}
}
......