uniapp(小程序)和webview之间的传参
uniapp和webview间主要是靠url
//uniapp中的页面
<template>
<web-view :src="url"> </web-view>
</template>
<script>
export default {
data() {
return {
url:"https://www.baidu.com?part_id=1&type=0&filename=Jack"
}
}
}
</script>
//webview文件
<script>
export default{
data(){
return{
part_id:"",
type:"",
filename:""
}
}
methods:{
onload:function(options){
this.part_id = options.part_id;
this.type = options.type;
this.filename = options.filename;
}
}
}
</script>
复制代码
总结
传参总体来说比较简单,但是存在一个问题我没有解决,
需求是这样的,从小程序传递一个参数过来,让微信的navigator上显示文件名字
但是实际解决起来
uniapp页面

模型没有加载完成之前

模型加载完成之后


会显示webview的index.html的title的名字,尝试了使用dom操作页面,但这样会导致页面整个页面重排,而且样式出错,暂时没有找到解决的办法
393


和webview之间的传参&spm=1001.2101.3001.11974&articleId=108265768&d=1&t=3&u=ba2b19e8bf4241018b3fd6b3aaa54d67)

被折叠的 条评论
为什么被折叠?



