直接上代码
/*** drawer afterOpen 抽屉打开后*/exportfunctionafterOpen() { //设置一个定时器每隔500毫秒执行constintervalId=setInterval(() => { letdrawerId='drawer_llkh0bhj'; //抽屉组件idlet { iframe } =this.$('iframe_llkh0bhk'); //你的iframe组件console.log(iframe.contentWindow.location.pathname) if (iframe) { let { pathname } =iframe.contentWindow.location; //检测流程表单或者移动端普通表单网址是否包含formDetail或者processDetailif (_.includes(pathname, 'formDetai') ||_.includes(pathname, 'processDetail')) { intervalId&&clearInterval(intervalId); this.$(drawerId).hide(); } //PC端判断普通表单提交状态letresultEle=iframe.contentWindow.document.querySelector('.yida-submit-result .result-content .result-tips'); //如果iframe内特定元素显示提交成功if (resultEle&&resultEle.textContent==='提交成功') { intervalId&&clearInterval(intervalId); this.$(drawerId).hide(); } } }, 500); //将关闭句柄赋值给全局变量,抽屉关闭时需要用到this.setState({ intervalId }); } /*** drawer afterClose 抽屉关闭后*/exportfunctionafterClose() { const { intervalId } =this.state; intervalId&&clearInterval(intervalId); //清除定时器}
+