|
@@ -690,6 +690,22 @@ export default {
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ /**
|
|
|
|
+ * @description 处理popover显隐
|
|
|
|
+ * 当点击位置不在canvas内部时 ( 如点击 页面空白,图例,楼层,设备设施左侧列表项时),将popover的display置为none,
|
|
|
|
+ * 当点击位置在canvas内部时,将popover的display设置为'block'
|
|
|
|
+ */
|
|
|
|
+ handlePopover(e) {
|
|
|
|
+ if (this.$refs.graphy.contains(e.target)) {
|
|
|
|
+ if (this.$refs.popover && this.$refs.popover.popperElm) {
|
|
|
|
+ this.$refs.popover.popperElm.style.display = 'block'
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (this.$refs.popover && this.$refs.popover.popperElm) {
|
|
|
|
+ this.$refs.popover.popperElm.style.display = 'none'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
'view.scale': {
|
|
'view.scale': {
|
|
@@ -707,6 +723,11 @@ export default {
|
|
mounted() {
|
|
mounted() {
|
|
this.mapSize()
|
|
this.mapSize()
|
|
this.getEvent()
|
|
this.getEvent()
|
|
|
|
+ // 添加监听点击事件,处理popover显隐
|
|
|
|
+ window.addEventListener('click', this.handlePopover, false)
|
|
|
|
+ this.$once('hook:beforeDestroy', () => {
|
|
|
|
+ window.removeEventListener('click', this.handlePopover)
|
|
|
|
+ })
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
// document.addEventListener("mousedown", () => {
|
|
// document.addEventListener("mousedown", () => {
|