fix:修复小地图位置问题

main
zhu.yawen 1 year ago
parent de88c49737
commit 41e86f1865

@ -63,18 +63,28 @@ export default {
}, },
data () { data () {
return { return {
count: 0,
right: 0
} }
}, },
watch: { watch: {
rightVisiable (value) { rightVisiable (value) {
const leftElement = document.querySelector('.bs-left-panel')
const contentElement = document.querySelector('.grid-wrap-box')
// const rightElement = document.querySelector('.bs-right-panel-wrap')
const mapElement = document.querySelector('.minimap')
if (value) { if (value) {
const leftElement = document.querySelector('.bs-left-panel')
const contentElement = document.querySelector('.grid-wrap-box')
// const rightElement = document.querySelector('.bs-right-panel-wrap')
const mapElement = document.querySelector('.minimap')
if (parseInt(window.getComputedStyle(mapElement).right) > parseInt(window.getComputedStyle(leftElement).width) + parseInt(window.getComputedStyle(contentElement).width) - 320 - parseInt(window.getComputedStyle(mapElement).width)) { if (parseInt(window.getComputedStyle(mapElement).right) > parseInt(window.getComputedStyle(leftElement).width) + parseInt(window.getComputedStyle(contentElement).width) - 320 - parseInt(window.getComputedStyle(mapElement).width)) {
//
this.count = 1
this.right = window.getComputedStyle(mapElement).right
mapElement.style.right = parseInt(window.getComputedStyle(leftElement).width) + parseInt(window.getComputedStyle(contentElement).width) - 320 - parseInt(window.getComputedStyle(mapElement).width) + 'px' mapElement.style.right = parseInt(window.getComputedStyle(leftElement).width) + parseInt(window.getComputedStyle(contentElement).width) - 320 - parseInt(window.getComputedStyle(mapElement).width) + 'px'
} }
} else {
if (this.count === 1) {
mapElement.style.right = this.right
this.count--
}
} }
} }
}, },

Loading…
Cancel
Save