一个封装了的唤起程序
示例程序可以参考这个
https://github.com/withwz/callapp-lib/blob/master/example/index.html
uniapp设置
在distribute-》android-》设置schemes,可以是一个数组
"distribute": {"android": {"schemes": ["e3krnb","ebb"]}}
易帮帮示例
<template><view class="container"><CmdNavBar:back="`ooo`"left-text="我的"title="易帮帮"iconTwo="help"font-color="#fff"background-color="rgb(216,40,37)"@iconTwo="linkManager('../help/help')"/><!-- #ifdef APP-PLUS --><view class="status-bar"></view><view style="height:92upx"></view><!-- #endif --><button @click="install">安装</button></view></template><script>import { mapState, mapActions, mapMutations } from "vuex";import CallApp from "callapp-lib";import { msgToken } from "@/api/request";import routerManager from "@/unit/routerManager/routerManager";import CmdNavBar from "@/components/cmd-nav-bar/cmd-nav-bar.vue";export default {data() {return {lib: ""};},computed: {...mapState({userId: state => state.user.userId})},onLoad(params) {this.checkAppStatus();},methods: {...mapMutations(["TOKEN_VERIFY"]),linkManager(url) {routerManager(url);},install() {const callLab = this.lib;console.log(callLab);callLab.open({path: "profile"});// 因为业务需要,我们需要添加 outChain 属性// 但是这样生成出来的 scheme 稍显复杂,所以下面的 log 其实是移除了 outChain 属性的// outChain 很少有同学会使用到,所以更方便大家理解// ykshortvideo://profileconsole.log(callLab.generateScheme({ path: "profile" }));// intent://profile#Intent;package=com.youku.shortvideo;scheme=ykshortvideo;S.browser_fallback_url=https%3A%2F%2Fdianliu.youku.com%2Fservice%2Fdownload;end;console.log(callLab.generateIntent({ path: "profile" }));// https://flash-link.youku.com?action=profileconsole.log(callLab.generateUniversalLink({ path: "profile" }));},checkAppStatus() {const option = {scheme: {protocol: "ebb"},/*** 应用宝链接*/yingyongbao: "//a.app.qq.com/o/simple.jsp?",/*** 唤起失败跳转的链接*/fallback: "https://www.baidu.com/",timeout: 2000};this.lib = new CallApp(option);}},components: {CmdNavBar}};</script><style lang="scss" scoped>/*沉浸状态栏变化*/.status-bar {width: 750upx;height: var(--status-bar-height);}</style>
