通过querySelectorAll获取a标签,并进行其他操作。参考代码如下。

private querySelector(){
   let arrayOfLinks = document.querySelectorAll('a');
   for (let i = 0; i < arrayOfLinks.length; i++) {
       const anchor = arrayOfLinks[i];
       if (anchor.href.length == 0){
           continue;
       }
       anchor.onclick = (ev) => {
           let alert =  this.uiService.showConfirm('是否打开链接:'+anchor.href,null,()=>{
               if (BrowserUtil.isMobile(this.platform)){
                   YbbHybirdUtil.openLink(anchor.href,null);
               } else{
                   window.open(anchor.href, '_system');
               }
           },()=>{
           });

           alert.present();
           ev.preventDefault();
           return false;
       };
   }
}