1、vue页面
1、用web-view或iframe引入html,src为html页面的路径
<web-view :src="html" ></web-view> //hbuilder中使用web-view
<iframe :src="html" ></iframe>
2、vue页面向html页面传参时需要加密(参数直接在路径后面用问号带过去):
this.html = '../../static/html/video.html?videoUrl'+encodeURIComponent(this.videoUrl)+'&token='+encodeURIComponent(this.token)
2、html页面-----通过url截取参数
<script type="text/javascript">
window.onload=function(){
let _url = window.location.search
let url = decodeURIComponent(_url) //对传过来的参数解码
let url1 = url.slice(9) //删掉参数前面的?
document.getElementById("v1").src='https://api.zfjituan.com'+url1;
}
</script>
切记:
1、如果在hbuild中引用html页面,html页面位置可以随便放;
2、如果要在vscode中,要放在项目的根目录下,不然找不见;
引入路径:直接写文件名即可,前面不用加"/";否则部署到线上会找不到