diff --git a/ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue b/ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue index 7070807..20b57ed 100644 --- a/ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue +++ b/ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue @@ -171,15 +171,13 @@ export default { }, mounted() { - //监听浏览器宽度的改变 - // window.onresize = function(){ - // _this.changeMargin(); - // _this.border() - // }; - // - // this.changeMargin(); - // - // this.border() + // 监听浏览器宽度的改变 + const resizeObserver = new ResizeObserver(entries => { + for (let entry of entries) { + this.changeMargin(); + } + }); + resizeObserver.observe(document.querySelector('.location')); }, methods: { loadFrom() { @@ -574,7 +572,6 @@ export default { $("#editable-num").append("<option value='" + i + "'>" + i + "</option>") } } - _this.changeMargin(); _this.Search(); } }); @@ -603,7 +600,7 @@ export default { $(".location").append("<img data-i=" + num + " data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>"); } } - this.changeMargin(); + // this.changeMargin(); this.ajaxGrid(index, data); } else if (index === "line") { data = {zoneCode: this.zoneCode, line: num}; @@ -614,7 +611,7 @@ export default { $(".location").append("<img data-i=" + l + " data-j=" + num + " data-k=" + k + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>"); } } - this.changeMargin(); + // this.changeMargin(); this.ajaxGrid(index, data); } else if (index === "layer") { data = {zoneCode: this.zoneCode, layer: num}; @@ -625,7 +622,7 @@ export default { $(".location").append("<img data-i=" + m + " data-j=" + n + " data-k=" + num + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>"); } } - this.changeMargin(); + // this.changeMargin(); this.ajaxGrid(index, data); } },