From e960d9c617b98c2996b123ebd5b5a9cc6703c2cf Mon Sep 17 00:00:00 2001 From: "LAPTOP-7F135LL2\\jly" <48982819@qq.com> Date: Mon, 7 Aug 2023 14:23:55 +0800 Subject: [PATCH] 1 --- .../dataBoard/fifteen/components/index.vue | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/views/dataBoard/fifteen/components/index.vue b/src/views/dataBoard/fifteen/components/index.vue index 4e085c994..bf71db910 100644 --- a/src/views/dataBoard/fifteen/components/index.vue +++ b/src/views/dataBoard/fifteen/components/index.vue @@ -68,7 +68,6 @@ import Map from 'ol/Map'; import View from 'ol/View'; import { defaults as defaultControls } from 'ol/control.js'; import { Circle, Point, Polygon } from 'ol/geom'; -import { Select } from 'ol/interaction'; import { Tile as TileLayer, Vector as VectorLayer } from 'ol/layer'; import { getPointResolution } from 'ol/proj'; import { METERS_PER_UNIT } from 'ol/proj/Units'; @@ -142,28 +141,28 @@ export default { //添加标注 this.map.addOverlay(this.overlay); const _this = this; - let select = new Select({ - style: new Style({ - stroke: new Stroke({ - color: "rgb(0, 153, 255,1)", - width: 2 - }), - fill: new Fill({ - color: "rgb(209, 203, 189,0.6)" - }) - }) - }); - //map加载该控件,默认是激活可用的 - _this.map.addInteraction(select); - console.log(99999, select); - select.on("select", function (e) { - console.log("选中要素"); - // console.log(e.selected[0].get('name')); //打印已选择的Feature的name属性 - let currentRome = e.selected[0]; //获取当前选中的节点 - console.log(e) + // let select = new Select({ + // style: new Style({ + // stroke: new Stroke({ + // color: "rgb(0, 153, 255,1)", + // width: 2 + // }), + // fill: new Fill({ + // color: "rgb(209, 203, 189,0.6)" + // }) + // }) + // }); + // //map加载该控件,默认是激活可用的 + // _this.map.addInteraction(select); + // console.log(99999, select); + // select.on("select", function (e) { + // console.log("选中要素"); + // // console.log(e.selected[0].get('name')); //打印已选择的Feature的name属性 + // let currentRome = e.selected[0]; //获取当前选中的节点 + // console.log(e) - }) - return + // }) + // return _this.map.on("click", function (e) { _this.featureInfo = {} let feature = _this.map.forEachFeatureAtPixel(e.pixel, function (feature) {