navigateTo跳轉到外部頁面


在使用navigator進行跳轉時,只能跳轉到本地頁面,當跳轉到外部鏈接時無反應

思路就是先跳轉到本地頁面,然后在本地頁面渲染外部鏈接的網頁

執行跳轉的頁面  /index/index.vue

<view v-for="(items, index) in list" @tap="gotoNew(items.title)">
    ....
</view>
methods: {
    gotoNew:function(t){
        uni.navigateTo({
            url:'./details?title='+t
        })
    }
},

將要跳轉的頁面 /index/details.vue

<template>
    <web-view :src="url" :progress="false"></web-view>
</template>

<script>
    export default {
        data() {
            return {
                url:'https://www.baidu.com',
                title:''
            }
        },
        onLoad(res) {
            this.title=res.title;
        },
        onReady(){
            uni.setNavigationBarTitle({
                title:this.title
            })
        }
    }
</script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM