直接上代码
<template>
<!-- iframe -->
<div class="iframe" ref="iframe">
<iframe
id="mainIframe"
name="mainIframe"
src="链接"
frameborder="0"
scrolling="auto"
onload="mainIframe.focus()"
></iframe>
</div>
</template>
最重要的是iframe 的id和 onload事件