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; return;
} }
const buttons = this.modalTarget.getElementsByTagName('button'); const buttons = this.modalTarget.getElementsByTagName('button');
const links = this.modalTarget.getElementsByTagName('a');
const elements = [...buttons, ...links];
const { innerHTML = '' } = e.target || {}; const { innerHTML = '' } = e.target || {};
let isButton = false; let isClickable = false;
for (let i = 0; i < buttons.length; i++) { const specialInner = ['-', ''];
if (isButton) { for (let i = 0; i < elements.length; i++) {
if (isClickable) {
return; return;
} }
const specialInner = ['-', ''];
if ( if (
!specialInner.includes(innerHTML) && !specialInner.includes(innerHTML) &&
buttons[i].innerHTML.includes(innerHTML) elements[i].innerHTML.includes(innerHTML)
) { ) {
isButton = true; isClickable = true;
} }
} }
if (isButton) { if (isClickable) {
return; return;
} }
this.stopEvent(e); this.stopEvent(e);