首页 > 其他分享 >iframe跳转到嵌入的html锚点

iframe跳转到嵌入的html锚点

时间:2023-02-10 14:12:44浏览次数:46  
标签:console item html 锚点 跳转 newValue tempList

<iframe id="tempHtml" name="myframe" style="width:100%;height:100%;"  :src="frameUrl+ '#toolbar=0'" frameborder="0" scrolling="auto" ></iframe>
watch: {
anchor: {
deep: true,
immediate:true,
handler (newValue, oldValue) {
console.log('监听新值',newValue,'|||||||||||||||',oldValue)

this.$nextTick(()=>{
this.tempList = [...document.getElementById('tempHtml').contentWindow.document.querySelectorAll('a[href]')]
console.log(newValue,'监听锚点',this.tempList)
this.tempList.map((item) => {
if (item.hash == newValue) {
item.click()
} else {

}
})
})




}
}
},

标签:console,item,html,锚点,跳转,newValue,tempList
From: https://www.cnblogs.com/connie256/p/17108703.html

相关文章