<iframe id="tempHtml" name="myframe" style="width:100%;height:100%;" :src="frameUrl+ '#toolbar=0'" frameborder="0" scrolling="auto" ></iframe>
watch: {标签:console,item,html,锚点,跳转,newValue,tempList From: https://www.cnblogs.com/connie256/p/17108703.html
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 {
}
})
})
}
}
},