# Official Account message template

The developer can be App Adopted in webview In order to provide users with a better experience, the Official Account message template, mini program cards and WeChat Channels cards are inserted in some of the articles. Now the framework has been adapted for the Official Account message template, mini program card and WeChat Channels card in the article. After clicking, users can jump to the corresponding mini program page and then click on the corresponding card to complete the relevant operation.

# Prerequisite

1, the current multi-terminal application has been bound mobile application account, and configure the development of mobile applications information

2, multi-terminal application binding Mini Program has been released on the line, and the Mini Program involved Page Already configured. onShareAppMessage

3、SDK It needs to be up to date, i.e. Android SDK need 1.2.9iOS SDK need 1.2.13

# Adaptation principle

  • The essence of the adaptation is to trigger the onShareAppMessage Callback to get the target Mini Program page path and Mini Program type after initiating the jump. Developers can decide the final page of the jump Mini Program and the type of the Mini Program according to their own business logic.

# Return parameter

attribute type Default value Required Introductions
path string yes The path to the page you want to open when you jump the Mini Program
MiniprogramType number 0 no Jump Mini Program type

# sample code


let IS_SAAASDK = false

Page({
  onLoad() {
    wx.getSystemInfoAsync({
      success: (res) => {
        IS_SAAASDK = res.host.env  === "SAAASDK"
      }
    })
  },
  onShareAppMessage () {
    // Return Page Path and Mini Program Type in Multiple Scenarios
    if (IS_SAAASDK) {
      return {
        path: '/pages/webview/index?url=https://mp.weixin.qq.com?fromSAAASDK=1', // The path to the page you want to open when you jump the Mini Program
        MiniprogramType:  1, // Jump Development Version
      }
    }
    
    // Custom Share Card Under Mini Program Scene
    return {
      title: "Custom Forward Title,"
      path: '/pages/webview/index?url=https://mp.weixin.qq.com',
    }
  },
})

# Interactive schematic