WeChat Mini Program·Get Mini Program Version Number

 The basic library version of the mini program  2.10.2 provides the function of obtaining the version number of the online mini program. The code is as follows:


 in app.js

    const miniProgram  = wx.getAccountInfoSync();
    this.version = miniProgram.miniProgram.version;
    console.log(this.version)

In the page js that needs to introduce the version number: 

const app = getApp();
const version = app.version

To be careful of

The online mini program version number can only be obtained in the official version of the mini program, and cannot be obtained in the development version and trial version.

For details, view the official documentation Object wx.getAccountInfoSync() | WeChat open documentation

Guess you like

Origin blog.csdn.net/PDDcute/article/details/128297640