vue在页面嵌入别的页面或者是视频
以下是嵌入页面
<iframe name="myiframe" id="myrame" src="http://xxx.com/" frameborder="0" align="left" width="100%" height="100%" scrolling="auto" marginWidth=0 marginHeight=0 class="iframesty" onload="changeFrameHeight()"> <p class="tip">你的浏览器不支持iframe标签</p> </iframe>
scrolling="auto"=》可以滚动
scrolling="no"=》不可以滚动
onload="changeFrameHeight()=》根据适配的font-size大小改变初始化时候的高度
在index.html页面写js
window.addEventListener("orientationchange", resetrem); window.addEventListener("resize",resetrem); function resetrem(){ var fs = parseInt(document.querySelector("html").style.fontSize) return fs } function changeFrameHeight(){ var fs = resetrem() var ifm = document.getElementById('myrame'); ifm.height = document.documentElement.clientHeight - fs-6 }
嵌入视频
<div class="toast" :class="{tshow:toastshow}" style="90%;height:300px"> <iframe frameborder="0" :src="this.video_url" allowFullScreen="true" style="100%;height:300px" ></iframe> </div> <div :class="{mask:maskshow}" @click="hidden_video" @touchmove.prevent></div>