当前位置:网站首页>微信小程序内部A页面向内嵌H5页面跳转,并且传参
微信小程序内部A页面向内嵌H5页面跳转,并且传参
2022-08-11 00:10:00 【小任睡不醒`】
小程序中A页面代码JS代码
Page({
toPtol(e){
const id=e.currentTarget.dataset['id'];
const loadId=e.currentTarget.dataset['loadid'];
console.log(loadId)
wx.navigateTo({
url: '/pages/protocol/index?money=32132&loadId='+loadId
})
},
})小程序中内嵌H5容器页面index.wxml
<web-view src="{
{url}}"></web-view>小程序中内嵌H5容器页面index.js
Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options);
this.setData({
url:'https://www.zhiyunyi.net/protocol.html?money='+options.mone+'&loadId='+options.loadId+''
})
},
} 远程H5页面获取参数JS代码
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)")
var r = window.location.search.substr(1).match(reg)
if (r != null) return unescape(r[2])
return null
}
var loadId =getUrlParam('loadId')
console.log(loadId)2.H5页面向小程序传参
内嵌H5JS代码
1.首先引入
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>2.添加跳转到小程序页面的代码,参数直接拼接
wx.miniProgram.reLaunch({ url: '/pages/index/index?name=张三&age=11'});小程序内部页面代码index.js
Page({
onLoad: function (options) {
//options 就是H5传入的参数
}3.内嵌H5页面的调试
1.首先引入
<script type="text/javascript" src="https://wechatfe.github.io/vconsole/lib/vconsole.min.js?v=3.3.0"></script>2.JS中添加如下代码
window.vConsole = new window.VConsole();3.再需要的地方打印console.log就可以了,这个方法特别适用远程web页面在手机端调试问题
边栏推荐
- [Excel knowledge and skills] Convert numeric format numbers to text format
- "NIO Cup" 2022 Nioke Summer Multi-School Training Camp 2 DGHJKL Problem Solution
- LeetCode_优先级队列_692.前K个高频单词
- Which foreign language journals and conferences can be submitted for software engineering/system software/programming language?
- Design and Realization of Employment Management System in Colleges and Universities
- 云原生-VMware虚拟机安装Kubesphere实战(一)
- 【经典排序】快速排序
- How to determine how many bases a number is?
- 7. yaml
- 百战RHCE(第四十八战:运维工程师必会技-Ansible学习3-构建Ansible清单)
猜你喜欢
随机推荐
7. yaml
What is the ASIO4ALL
NOR FLASH闪存芯片ID应用之软件保护场景
Starting a new journey - Mr. Maple Leaf's first blog
electron -autoUpdater 更新
Promote the high-quality development of denim clothing
两个数组的交集
LeetCode_优先级队列_692.前K个高频单词
Dump文件生成,内容,以及分析
关于科研学习中的几个问题:如何看论文?如何评价工作?如何找idea?
深度解析volatile关键字(保证够全面)
CF1534F2-Falling Sand (Hard Version)
[数据可视化] 图表设计原则
Web APIs BOM- 操作浏览器之综合案例
Three-column layout implementation
Lens filter---about day and night dual-pass filter
Based on the SSM to reach the phone sales mall system
盘点美军的无人机家底
sqlmap结合dnslog快速注入
Is there a way out in the testing industry if it is purely business testing?






![[C language] Implementation of guessing number game](/img/5d/13e8c409f9e53ccc53a15a7f1e0fea.png)


