There are two situations:
1. The browser jumps to h5
plus.runtime.openURL('https:564656w.com')
2. App embedded h5
Operations within the app:
1) Write a click event first, jump to the webview page of this project and pass a link to the h5 you want to jump to
uni.navigateTo({
url: '/pages/webView/webView?url=' + this.merchantUrl+'/#/pages/online-store/index'
})
2) Create a webview page as an intermediary, the src attribute is an h5 link, and plus.storage.setItem passes parameters like h5
<template>
<view class="webView">
<web-view :src="url"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
url: '' ,
}
},
onLoad(option) {
// app向内嵌的h5传参数(用户信息)
plus.storage.setItem('data',""+JSON.stringify(uni.getStorageSync('userInfo')));
this.url = option.url
console.log(option,'webview跳转option')
},
}
</script>
h5 operation:
First judge whether it is opened in the app, if it is in the app, connect to the reference, if not, go to the permission judgment and jump to the login page