1. When using uniapp to develop small programs, you need to jump to external links. The effect is as follows:
Second, the steps to achieve:
① First build a page webview.vue in your uniapp project pages.json
{
"path" : "pages/webview/webview",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
② All the codes in the page webview.vue are as follows:
<template>
<web-view :src="url"></web-view>
</template>
<script>
export default {
data() {
return {
url: ''
}
},
onLoad(e) {
this.url = decodeURIComponent(e.url)
}
}
</script>
③On the page that needs to be operated, trigger the jump through the click event
<template>
<view @click="mycat()">点击跳转</view>
</template>
<script>
mycat() {
let url = 'https://www.baidu.com/'
uni.navigateTo({
url: '/pages/webview/webview?url=' + url
})
},
</script>
It's done here~ okk