第一种

<script>
export default {
data() {
return {
sweixin: null
}
},
onLoad() {
this.getPlus()
},
methods: {
getPlus() {
//获取当前显示的webview
var pages = getCurrentPages()
var page = pages[pages.length - 1]
var currentWebview = page.$getAppWebview()
//调用H5+APP的扩展API
var shares = null;
let that = this
var pusher = plus.share.getServices(function(s) {
shares = {};
for (var i in s) {
var t = s[i];
shares[t.id] = t;
}
that.sweixin = shares['weixin'];
}, function(e) {
console.log("获取分享服务列表失败:" + e.message);
});
//放入当前的webview
currentWebview.append(pusher);
},
checkWeChat() {
//调用微信小程序
if(this.sweixin){
this.sweixin.launchMiniProgram({
id: '' //要跳转小程序的原始ID
})
} }
}
}
</script>

第二种

plus.share.getServices(
res => {
let sweixin = null;
for (let i in res) {
if (res[i].id == 'weixin') {
sweixin = res[i];
}
}
//唤醒微信小程序
if (sweixin) {
sweixin.launchMiniProgram({
id: 'gh_0720325777cc', //
type: 0, //小程序版本 0-正式版; 1-测试版; 2-体验版。
// path: 'pages/index/index?id=' + 1 //小程序的页面,用传的参数在小程序接值判断跳转指定页面
});
}
}
);

最新文章

  1. MVC4做网站后台:用户管理 &mdash;&mdash;用户组补充
  2. poj 3264(线段树)
  3. online_jf.lua --累计在线时间领取物品(积分)的lua脚本
  4. isDebugEnabled作用
  5. 【Hibernate 6】常用的hql语句以及N+1问题
  6. 团队项目的NABC
  7. HTML5 声明兼容IE的写法
  8. Xcode HeaderDoc 过程(1)
  9. shell脚本进阶之循环判断
  10. redis 配置文件解释 以及集群部署
  11. IDEA的Maxcomputer Studio开发
  12. Java 破解谷歌翻译api,可以实现程序自动化翻译文章
  13. shell 日期加减,日期大小比较的方法
  14. PHP实现数组中每个字符出现次数最多的,并且如果两个字符出现相同,则在前面的先输出功能
  15. Ado.net 访问Oracle乱码问题
  16. poj 3320(尺取法)
  17. [skill] mmap / fwrite / write linux磁盘读写的分层结构
  18. PHP中cookie思维导图
  19. 关于Java-枚举的总结
  20. 【CSS系列】图像映射

热门文章

  1. K8S发布应用步骤详解
  2. 使用NAT网络模式搭建内网,修改IP地址
  3. Lucky Tree
  4. Me-and-My-Girlfriend-1
  5. element-ui/lib/style.css in ./src/main.js 解决方案
  6. 如何把已安装的nodejs高版本降级为低版本(图文教程)
  7. pip使用阿里云镜像
  8. C语言学习--指针大小端
  9. linux更新cmake(无需删除旧版本)
  10. 使用伪元素 before 叹号