From 9c52169a5b7989eaa731526eea8bbe519a826ddf Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 18 Jan 2024 09:43:54 +0800 Subject: [PATCH] fixed --- src/modal/popconfirm.js | 4 ++++ src/modal/tooltip.js | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/modal/popconfirm.js b/src/modal/popconfirm.js index ca4e677..cc83745 100644 --- a/src/modal/popconfirm.js +++ b/src/modal/popconfirm.js @@ -150,6 +150,10 @@ class PopConfirm extends Component { if (left < 260 || (left > 260 && window.innerWidth - left > 260)) { placement = 'right' + left -= 12 + if (left < 0) { + left = 0 + } styles.left = left + 'px' } else { // 减去小三角形的位移 12px diff --git a/src/modal/tooltip.js b/src/modal/tooltip.js index ffd58b3..2013243 100644 --- a/src/modal/tooltip.js +++ b/src/modal/tooltip.js @@ -94,9 +94,16 @@ class Tooltip extends Component { if (left < 360 || (left > 360 && window.innerWidth - left > 360)) { placement = 'right' + left -= 12 + if (left < 0) { + left = 0 + } styles.left = left + 'px' } else { - let right = window.innerWidth - left - this.clientWidth + let right = window.innerWidth - left - this.clientWidth - 12 + if (right < 0) { + right = 0 + } styles.right = right + 'px' }