fix: fix click link in the modal-button

Fix no jump when click the link in the modal of the modal-button component

Change-Id: I13c8b2a47a89c978d44f6aa6ba33aa1156b9e464
This commit is contained in:
Jingwei.Zhang 2023-04-21 10:50:40 +08:00
parent b30e7ae9a3
commit 2a0b442921

View File

@ -189,21 +189,23 @@ export default class ModalButton extends Component {
return;
}
const buttons = this.modalTarget.getElementsByTagName('button');
const links = this.modalTarget.getElementsByTagName('a');
const elements = [...buttons, ...links];
const { innerHTML = '' } = e.target || {};
let isButton = false;
for (let i = 0; i < buttons.length; i++) {
if (isButton) {
let isClickable = false;
const specialInner = ['-', ''];
for (let i = 0; i < elements.length; i++) {
if (isClickable) {
return;
}
const specialInner = ['-', ''];
if (
!specialInner.includes(innerHTML) &&
buttons[i].innerHTML.includes(innerHTML)
elements[i].innerHTML.includes(innerHTML)
) {
isButton = true;
isClickable = true;
}
}
if (isButton) {
if (isClickable) {
return;
}
this.stopEvent(e);