# Overview
The operator of a Mini Program can authorize a third-party platform with just one click to develop services. The development of Mini Program client/admin console on third-party platforms differs from that by official Mini Program developers. For information on APIs owned by the third-party and related descriptions, see Implementing Services for Mini Program. For other information, see the following content.
Developing a Mini Program on a third-party platform is somewhat complicated. The following concepts should be noted:
- Open3rd: Third-party platform, a third-party developer officially recognized by Mini Program. See details.
- 3rdMiniProgramAppid: A Mini Program applied for by and bound to a third-party platform, used for developing the Mini Program template.
- extAppid: A Mini Program authorized to a third-party platform.
To develop a Mini Program on a third-party platform, some specific operations should be done:
- Developing a Mini Program template
- Developing and debugging a Mini Program template using extAppid
- Submitting code directly to the pending approval list using
directCommit
. See details.
The latest Weixin DevTools enable the development and preview of Mini Programs on third-party platforms.
# Creating a Project
Just like developing a normal Mini Program, developers of third-party platforms can create a project by filling in an appropriate 3rdMiniProgramAppid, setting a project name, and selecting the project directory.
For the Mini Program developed on a third-party platform, the relevant open3rd information and the third-party platform's 3rdMiniProgramAppid can be viewed in the project tab. If the extAppid is configured for the project, it is also displayed.
# Developing a Mini Program Template
As with the development of a normal Mini Program, after developing related business logic on the DevTools, developers can submit code for preview in the project tab to see what the Mini Program looks like in Weixin.
However, the code for a third-party Mini Program is uploaded to the template drafts under the open account of the third-party platform, and the platform's admin needs to configure the template independently. For more information, see open platform documentation.
# Developing and debugging a Mini Program template using extAppid
To make it easy for developers of third-party platforms to use extAppid for development and debugging, ext.json
needs to be introduced.
ext.json
is a configuration file stored at the root directory of a Mini Program project.
Here is an ext.json
file that contains all configuration options:
{
"extEnable": true,
"extAppid": "wxf9c4501a76931b33",
"directCommit": false,
"ext": {
"name": "Weixin",
"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": "Home"
}, {
"pagePath": "pages/logs/logs",
"text": "Log"
}]
},
"networkTimeout": {
"request": 10000,
"downloadFile": 10000
}
}
Configuration fields in ext.json
are divided into two types.
- Specific fields
- Fields same as those in
app.json
# Specific Fields
Property | Type | Required | Description |
---|---|---|---|
extEnable | Boolean | Yes | Sets whether ext.json takes effect |
extAppid | String | Yes | Sets extAppid |
ext | Object | No | A custom data field defined by developers |
extPages | String Array | No | Sets each page's json separately |
directCommit | Boolean | No | Indicates whether to submit code directly to the pending approval list |
# extEnable
extEnable
is a Boolean
type field that specifies whether the current ext.json
file is valid. Developers can modify this field to enable/disable the use of extAppid in the development.
# extAppid
extAppid
is an AppID
authorized for debugging. For example, when a developer enters wxf9c4501a76931b33
in this field, subsequent development logic will be run based on wxf9c4501a76931b33
if extEnable
is true.
# ext
The ext
field is a developer-defined data field whose configuration information can be obtained via wx.getExtConfigSync or wx.getExtConfig in Mini Programs.
In the above example, you can get all the configurations of the ext
field via wx.getExtConfigSync.
{
"name": "Weixin",
"attr": {
"host": "open.weixin.qq.com",
"users": [
"user_1",
"user_2"
]
}
}
# extPages
extPages
is an object where each key
should be the page defined in app.json
of the Mini Program template. The value
of each key
is the configuration item specified in page.json.
After this field is set, the Mini Program framework will modify the configuration of the corresponding page
.
# directCommit
directCommit
is a Boolean
type field that specifies whether to upload code directly to the approval list of extAppid.
When directCommit
is true
, the code uploaded via the DevTools is directly uploaded to the approval list of the corresponding extAppid, and the third-party platform can submit it for approval by directly calling https://api.weixin.qq.com/wxa/submit_audit?access_token=TOKEN
. For more information, see third party platform documentation.
When directCommit
is false
or is not specified, the code is uploaded to the corresponding drafts.
Note: The command line API or HTTP API in the DevTools can be used for auto submission for approval.
# Fields Same as Those in app.json
When the fields in ext.json
are same as those in app.json
, the fields in the former file will overwrite those in the latter file, as shown in the ext.json
below.
{
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "ext navigationBarTitleText",
"navigationBarTextStyle":"black"
}
}
The final navigationBarTitleText
of the Mini Program should be ext navigationBarTitleText
.