微信内部浏览器跳转微信小程序(h5跳转微信小程序) - 小_超超
发布时间:2022-09-08 10:18:12作者:顺晟科技点击:
微信内部浏览器跳转微信小程序(h5跳转微信小程序)
<template> //position: fixed不加这个自己的样式可能出不来 <div class="wxs" style="position: fixed"> <wx-open-launch-weapp username="gh_" path="/pages/home/index.html" > <script type="text/wxtag-template"> <style>.btn { width: 100%;height: 100%;}</style> <style>.img1{ width: 100%;height: 100%;object-fit: contain;}</style> <div class="btn" > <img class="img1" src="" alt=""> </div> </script> </wx-open-launch-weapp> </div> </template> <script> export default { data() { return { username: "", }; }, methods: { wxmini() { // 获取密钥 this.$api.publicapi.getWxinfo().then((res) => { wx.config({ // eslint-disable-line debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印 appId: res.data.appid, // 必填,公众号的唯一标识 timestamp: res.data.timestamp, // 必填,生成签名的时间戳 nonceStr: res.data.nonceStr, // 必填,生成签名的随机串 signature: res.data.signature, // 必填,签名 jsApiList: ["onMenuShareTimeline", "chooseImage", "previewImage"], // 必填,需要使用的JS接口列表 openTagList: ["wx-open-launch-weapp"], // 可选,需要使用的开放标签列表,例如[\'wx-open-launch-app\'] }); /* eslint-disable */ wx.ready(function () {}); wx.error(function () { alert("您的版本号不支持跳转微信小程序"); }); }); }, }, created() { const oScript = document.createElement("script"); oScript.type = "text/javascript"; oScript.src = "https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"; oScript.onload = this.wxmini(); document.body.appendChild(oScript); }, }; </script> 发表于 2021-04-09 16:15 小_超超 阅读(1440) 评论(1) 编辑 收藏 举报- 上一篇 : 微信应用号(小程序)开发教程一
- 下一篇 : 支付宝小程序开发准备工作