Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat Gadget Tool Third-party platform


May 20, 2021 WeChat Mini Program Development Document


Table of contents


Overview

Different from the development of ordinary small programs, the development of third-party platform small programs has a certain complexity, first of all, need to confirm three concepts

  • Open3rd: A third-party platform that is officially recognized by a small program for third-party developer details
  • 3rdMiniProgramAppid: A small program applied for by a third-party platform and bound to that platform for the development of small program templates
  • extAppid: A small program authorized to a third-party platform

Because of these differences, the development of small programs related to third-party platforms requires some special handling

  • Development of small program templates
  • Small program templates are combined with the development and debugging of extAppid

The latest version of the development tool supports the development and preview of third-party platform skits.

Create a project

Consistent with the development of common applets, third-party platform developers fill in the relevant 3rdMiniProgramAppid, set the project name and select the project catalog to create the project.

For third-party platform applets, you can view the relevant open3rd information and the current third-party 3rdMiniProgramAppid on the project page card, if the project is configured with the relevant extAppid, then the project page card will also have relevant information.

WeChat Gadget Tool Third-party platform

Small program template development

Consistent with the development of common small programs, developers can view the true performance of small programs in WeChat by submitting a preview in the project page card after developing the relevant business logic on the development tool.

Different, the submission of third-party platform applets is the template draft box uploaded to the OPEN account of the third party platform. The administrator of the platform needs to be set according to the template, more, please refer to Open platform documentation

ExtAppid development debugging

In order to facilitate the developers of third-party platforms to introduce ExtAppid development and commissioning work, it is necessary to introduce ext.json the concept of.

ext.json It is a configuration file that places in the root of the small program project.

The following is a contained ext.json

{
  "extEnable": true,
  "extAppid": "wxf9c4501a76931b33",
  "ext": {
    "name": "wechat",
    "attr": {
      "host": "open.weixin.qq.com",
      "users": [
        "user_1",
        "user_2"
      ]
    }
  },
  "extPages": {
    "pages/logs/logs": {
      "navigationBarTitleText": "logs"
    }
  },
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "Demo",
    "navigationBarTextStyle":"black"
  },
  "tabBar": {
    "list": [{
      "pagePath": "pages/index/index",
      "text": "首页"
    }, {
      "pagePath": "pages/logs/logs",
      "text": "日志"
    }]
  },
  "networkTimeout": {
    "request": 10000,
    "downloadFile": 10000
  }
}

There are two configuration fields in ext.json

  • Unique fields
  • The app.json

Unique fields

Property Type Required Describe
extEnable Boolean Is Configure whether ext.json is effective
extAppid String Is Configure extAppid
ext Object Whether Develop custom data fields
extPages String Array Whether Set the json for each page individually

extEnable

extEnable a Boolean field that specifies whether ext.json file is in effect, and developers can modify this field to turn on and off the combined development of extAppid.


extAppid

extAppid an appID for AppID for example, if the developer fills wxf9c4501a76931b33 then extEnable the subsequent development logic will run based wxf9c4501a76931b33


ext

ext field is a custom data field that can be obtained in a small program through wx.getExtConfigSync or wx.getExtConfig.

For example, in the example wx.getExtConfigSync ext

{
  "name": "wechat",
  "attr": {
    "host": "open.weixin.qq.com",
    "users": [
      "user_1",
      "user_2"
    ]
  }
}


extPages

extPages an object, and each key object should be a page defined in the small program template app.json and key value the configuration specified in page.json.

When the developer sets up this configuration, the small program framework changes the configuration information page to the page.

The app.json

When ext.json are consistent with those in app.json the fields in ext.json override app.json ext.json

{
  ········
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "ext navigationBarTitleText",
    "navigationBarTextStyle":"black"
  }
}

Then the program's navigationBarTitleText be ext navigationBarTitleText