Browse Source

fix: 菜单位置溢出的bug

master
xsx 7 months ago
parent
commit
c39a310e2f
  1. 16
      im-web/src/components/common/RightMenu.vue

16
im-web/src/components/common/RightMenu.vue

@ -26,9 +26,11 @@ export default {
},
methods: {
open(pos, items) {
this.pos = pos;
this.pos.x = pos.x;
this.pos.y = pos.y;
this.items = items;
this.show = true;
this.rejustPos();
},
close() {
this.show = false;
@ -36,6 +38,16 @@ export default {
onSelectMenu(item) {
this.$emit("select", item);
this.close();
},
rejustPos() {
let menuH = this.items.length * 36;
let menuW = 100;
if (this.pos.y > window.innerHeight - menuH) {
this.pos.y = window.innerHeight - menuH;
}
if (this.pos.x > window.innerWidth - menuW) {
this.pos.x = window.innerWidth - menuW;
}
}
}
}
@ -75,4 +87,4 @@ export default {
}
}
}
</style>
</style>
Loading…
Cancel
Save