hookehuyr

特殊处理边界问题-Bob需要展示例子

1 <!-- 1 <!--
2 * @Date: 2023-05-19 14:54:27 2 * @Date: 2023-05-19 14:54:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-07-11 15:12:46 4 + * @LastEditTime: 2024-07-12 14:59:31
5 * @FilePath: /map-demo/src/views/index.vue 5 * @FilePath: /map-demo/src/views/index.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -900,26 +900,27 @@ export default { ...@@ -900,26 +900,27 @@ export default {
900 900
901 // TODO: 暂时屏蔽等待数据设置字段 901 // TODO: 暂时屏蔽等待数据设置字段
902 // 只显示相应区域,移动会回到选定范围 902 // 只显示相应区域,移动会回到选定范围
903 - // this.lockMapBounds() 903 + const id = this.$route.query.id;
904 + if (id === '1759271') { // 定制开发
905 + this.lockMapBounds()
906 + }
904 907
905 }, 908 },
906 // 限制地图范围 909 // 限制地图范围
907 lockMapBounds() { 910 lockMapBounds() {
908 // var bounds = this.map.getBounds(); 911 // var bounds = this.map.getBounds();
909 var myBounds = new AMap.Bounds( 912 var myBounds = new AMap.Bounds(
910 - // [120.58626,31.316141], 913 + [117.045587,26.838764],
911 - // [120.588357,31.313204] 914 + [117.051081,26.8345723]
912 - [117.052221,26.834886],
913 - [117.046739,26.838553]
914 ); 915 );
915 916
916 this.map.setLimitBounds(myBounds); 917 this.map.setLimitBounds(myBounds);
917 918
918 let list =[ 919 let list =[
919 - [120.585097,31.316144], 920 + [117.045598,26.838764],
920 - [120.588264,31.316373], 921 + [117.051075,26.838779],
921 - [120.588712,31.313162], 922 + [117.051075,26.835107],
922 - [120.58609,31.313013] 923 + [117.045598,26.835107]
923 ] 924 ]
924 925
925 // 隐藏边界以外的区域 926 // 隐藏边界以外的区域
......