​直播平台开发,实现点击跳转外部链接时的跳转步骤

​直播平台开发,实现点击跳转外部链接时的跳转步骤

总体思路是用uni.navigateTo跳转一个渲染外部链接的内部页面

 


downLoad(item){
let url = encodeURIComponent(item.url)
uni.navigateTo({
url:'./webView?url='+url
})
},

url是文件路径。要用encodeURIComponent编码。不然路径会不完整

渲染外部要用web-view

webView.vue页面

 


<template>
<web-view :src="url" :progress="false"></web-view>
</template>
<script>
    export default {
        data() {
            return {
                url:'',
                title:''
            }
        },
        onLoad(res) {
console.log(res.url)
            this.url = decodeURIComponent(res.url);
console.log(this.url)
        },
onReady(){
            uni.setNavigationBarTitle({
                title:this.title
            })
        }
    }
</script>

 

以上就是 直播平台开发,实现点击跳转外部链接时的跳转步骤,更多内容欢迎关注之后的文章

 

posted @ 2022-03-16 14:11  云豹科技-苏凌霄  阅读(247)  评论(0)    收藏  举报