uni-app 跳转外部链接 素颜马尾好姑娘i 2022-11-16 10:55 536阅读 0赞 A页面用uni.navigateTo跳转一个**渲染外部链接**的内部B页面 url是文件路径。要用encodeURIComponent编码。不然路径会不完整 //A页面 tapdetail: function(i) { let url='http://saas.juwoxing.com/order/newpage/share/article_share.html?id='+i+'' url = encodeURIComponent(url) uni.navigateTo({ url:'softwendetail/softwendetail?url='+url }) }, 渲染外部要用web-view 记得接收到传过来的路径要用decodeURIComponent解码。实现跳转外部链接 //B页面 <template> <web-view :src="url" :progress="false"></web-view> </template> <script> export default { data() { return { url:'', title:'' } }, onLoad(op) { console.log(op.url) this.url = decodeURIComponent(op.url); console.log(this.url) }, onReady(){//改变标题 uni.setNavigationBarTitle({ title:this.title }) } } </script>
还没有评论,来说两句吧...