设置iframe大小和页面大小一致 & iframe 隐藏滚动条后 ,滚动失效 ,使用样式来控制
<div class="container">
<iframe class="iframe-box" ref="myIframe" :src="url" frameborder="0"></iframe>
</div>
name: "",
props: {},
data() {
return {
height: window.innerHeight + "px",
width: window.innerWidth + 25 + "px",
url: this.$route.query.url,
title: this.$route.query.title,
};
},
created() {
document.title = this.title; //设置路由标题
},
mounted() {
this.$refs.myIframe.style.height = this.height;
this.$refs.myIframe.style.width = this.width;
},
};
.container {
width: 100%;
height: 100%;
}
.iframe-box {
position: relative;
left: -17px;
}