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' }