Giter Club home page Giter Club logo

vpush-pro-sdk's Introduction

vPush SDK Pro

高级版本专用
https://mssnn.cn
详细文档:http://doc.mssnn.cn

示例

小程序代码片段地址:https://developers.weixin.qq.com/s/905pzCma704O

提示:经过测试,测试号appId可进行正常操作,但无法接收模板消息。
导入请务必填写正确的AppId,以及修改app.jsnew vPush定义的AppId

配置域名

我们为每一个开发者都配置了独立的子域名,你可以直接在浏览器中输入: https://你的小程序AppId.mssnn.cn
进入开发控制台(初次访问需要进行简单注册)

同时,这个地址也是收集推送凭证等后端API服务地址,所以我们前往微信公众号平台,在开发设置里配置request域名为此。

配置SDK

1. clone本仓库到你的微信小程序目录

$ git clone https://github.com/guren-cloud/vpush-pro-sdk

2. 编辑app.js,引入sdk的vpush.pro.js文件,并初始化一个全局的vPush变量:

// app.js
var vPush = require('./libs/vpush-pro-sdk/vpush.pro.js');

App({
  vPush: new vPush('小程序的appId'),
  onLaunch: function () {}
  // ...
});

初始化vPush类,需要传递你当前的微信小程序AppId

3. 使用sdk的组件

在sdk的components里,我们预置了部分组件,让你只需要经过简单的配置使用即可完成自动收集推送凭证流程。

页面json配置:

{
  "usingComponents": {
    "vpush-view": "/vpush-pro-sdk/components/view"
  }
}

页面wxml引入:

  <vpush-view>点击收集凭证</vpush-view>

你可以传递onClickHandler以绑定页面定义的方法,以及传递custom-class自定义组件样式

4. 最简单的sdk集成组件

我们提供了一些界面组件提供给开发者,让开发者在无需改动原始界面和代码的情况下快速集成使用。

4.1 checkin签到组件

在页面中引入组件后,在wxml文件直接嵌入该组件即可。
这个组件会每天用户打开小程序的时候,弹出一个签到框,用户点击签到按钮即可自动收集凭证。 无需过多开发。

更详细的文档,请移至:http://doc.mssnn.cn

旧版本迁移

如果你的小程序项目中已经配置过旧版本(目前称之为社区版)的SDK,那么除了重新配置外,还可以通过稍微修改,以达到兼容的目的。

  1. 复制新版本vpush.pro.js的文件内容;
  2. 编辑旧版本_vpush.js文件,全选粘贴覆盖旧版本文件内容;
  3. 覆盖完毕,在编辑好的vpush.pro.js文件底部的module.exports = vPush;代码,改成module.exports = new vPush('你的小程序AppId');

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.