Coder Social home page Coder Social logo

lovoror / js-arouse-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sunhaikuo/js-arouse-app

0.0 0.0 0.0 6 KB

移动端在微信、微博、QQ、Safari 唤起 App 的解决方案

Home Page: https://segmentfault.com/a/1190000012940046

JavaScript 47.10% TypeScript 52.90%

js-arouse-app's Introduction

概述

使用js唤起Native下的App,在 QQ、微博、微信中的简单库文件,只需要配置三项,库来帮你完成所有情况的唤起

用法

  • js:直接引用./js/arouse.js到 HTML 中
  • ts:如果你项目基于ts,请使用把ts目录下所有文件拷贝到项目中

ts 结构

  • Browser.ts为判断系统、浏览器,不涉及业务
  • AppLink.ts为判断环境,跳转相应操作,为主要代码
  • IBrowser.tsIAppLink.ts为相应的约束接口

使用

  • 引入 AppLinkIAppLink
  • 配置必须的信息(js 版不用添加 IAppLink 约束,其他一样)
let config: IAppLink = {
    // 和app协定的scheme
    schema: 'mtlf://scheme?p=home',
    // iOS下的App在appstore的地址
    appstore: '//itunes.apple.com/cn/app/%E4%BE%83%E4%BE%83%E7%8C%A9/id1267259289?mt=8',
    // 应用宝的地址
    yyb: '//a.app.qq.com/o/simple.jsp?pkgname=com.mtime.lookface&fromcase=40002'
}
  • 初始化
let applink = new AppLink(config)
applink.open()

为什么没有 demo

因为把这个页配置成universal link,必须使用域名直接访问,使用localhostip访问,效果会很差,所以只提供源码,demo 在博客中可以扫码体验。

js-arouse-app's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.