perf: 优化长按消息菜单显示逻辑

This commit is contained in:
kuaifan 2024-10-28 20:53:57 +08:00
parent 36f313380e
commit b1776c82ad

View File

@ -275,6 +275,7 @@
<!--长按右键--> <!--长按右键-->
<div class="operate-position" :style="operateStyles" v-show="operateVisible"> <div class="operate-position" :style="operateStyles" v-show="operateVisible">
<Dropdown <Dropdown
ref="operate"
trigger="custom" trigger="custom"
placement="top" placement="top"
:visible="operateVisible" :visible="operateVisible"
@ -1432,9 +1433,10 @@ export default {
}, },
operateVisible(val) { operateVisible(val) {
if (!val && !this.pointerMouse) { if (val || this.pointerMouse || this.focusLazy) {
document.getSelection().removeAllRanges(); return
} }
document.getSelection().removeAllRanges();
}, },
}, },
@ -2812,7 +2814,13 @@ export default {
height: `${height}px`, height: `${height}px`,
} }
this.operateClient = {x: left, y: event.clientY}; this.operateClient = {x: left, y: event.clientY};
this.operateVisible = true; if (this.operateVisible) {
try {
this.$refs.operate.$refs.drop.popper.update()
} catch (e) {}
} else {
this.operateVisible = true;
}
}) })
}, },
@ -3780,7 +3788,6 @@ export default {
$A.messageError(msg); $A.messageError(msg);
}); });
}, },
} }
} }
</script> </script>