mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
Demo:修复右键菜单中的二级菜单会超出边界的问题
This commit is contained in:
@@ -344,12 +344,11 @@ export default {
|
||||
|
||||
// 计算右键菜单元素的显示位置
|
||||
getShowPosition(x, y) {
|
||||
this.subItemsShowLeft = false
|
||||
const rect = this.$refs.contextmenuRef.getBoundingClientRect()
|
||||
if (x + rect.width > window.innerWidth) {
|
||||
x = x - rect.width - 20
|
||||
this.subItemsShowLeft = true
|
||||
}
|
||||
this.subItemsShowLeft = x + rect.width + 150 > window.innerWidth
|
||||
if (y + rect.height > window.innerHeight) {
|
||||
y = window.innerHeight - rect.height - 10
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user