fix: 消息太长导致菜单无法正常显示

This commit is contained in:
kuaifan 2024-03-19 03:14:09 +09:00
parent 6218521dea
commit 3596475790

View File

@ -2748,10 +2748,20 @@ export default {
}
this.$nextTick(() => {
const rect = el.getBoundingClientRect();
const scrollerRect = this.$refs.scroller.$el.getBoundingClientRect();
let top = rect.top + this.windowScrollY,
height = rect.height;
if (rect.top < scrollerRect.top) {
top = scrollerRect.top
height -= scrollerRect.top - rect.top
}
if (rect.bottom > scrollerRect.bottom) {
height -= rect.bottom - scrollerRect.bottom
}
this.operateStyles = {
left: `${event.clientX}px`,
top: `${rect.top + this.windowScrollY}px`,
height: rect.height + 'px',
top: `${top}px`,
height: `${height}px`,
}
this.operateClient = {x: event.clientX, y: event.clientY};
this.operateVisible = true;