需求:點擊A頁面的
跳轉網(wǎng)頁
按鈕跳轉到B頁面聂示,B頁面使用web-view
組件(用于展示H5),并向H5傳遞參數(shù)蛋叼,H5彈框要顯示這些參數(shù)落包。
image.png
做法:
image.png
- index.js
jumpWeb(){
wx.navigateTo({
url: '../webView/webView?type=' + '1' + "&orderId=" + '6666'
})
}
image.png
- webView.js
onLoad: function (options) {
this.setData({
webSrc:'http://extend.feiyang.life/#/login?type=' + options.type + "&orderId=" + options.orderId
})
},
- webView.wxml
<web-view src='{{webSrc}}'></web-view>
image.png
(vue項目)
- Login.vue
mounted() {
// 獲取瀏覽器的參數(shù)并彈框
var type = this.$route.query.type;
var orderId = this.$route.query.orderId;
var toastMsg = 'type為 ' + type + ' orderId為 ' + orderId;
this.$fyToast(toastMsg);
},