master
yutent 2024-01-18 09:43:54 +08:00
parent 16bdecc7a6
commit 9c52169a5b
2 changed files with 12 additions and 1 deletions

View File

@ -150,6 +150,10 @@ class PopConfirm extends Component {
if (left < 260 || (left > 260 && window.innerWidth - left > 260)) { if (left < 260 || (left > 260 && window.innerWidth - left > 260)) {
placement = 'right' placement = 'right'
left -= 12
if (left < 0) {
left = 0
}
styles.left = left + 'px' styles.left = left + 'px'
} else { } else {
// 减去小三角形的位移 12px // 减去小三角形的位移 12px

View File

@ -94,9 +94,16 @@ class Tooltip extends Component {
if (left < 360 || (left > 360 && window.innerWidth - left > 360)) { if (left < 360 || (left > 360 && window.innerWidth - left > 360)) {
placement = 'right' placement = 'right'
left -= 12
if (left < 0) {
left = 0
}
styles.left = left + 'px' styles.left = left + 'px'
} else { } 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' styles.right = right + 'px'
} }