在使用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>
