uniapp 获取设置的 App 版本号

页面展示APP版本

<!-- #ifdef APP-PLUS -->
<view class='item acea-row row-between-wrapper'>
  <view>APP版本号</view>
<view class='input acea-row row-between-wrapper'>
  <input type='text' :value="this.version" disabled='true' class='id'></input>
<text class='iconfont icon-suozi'></text>
</view>
</view>
<!-- #endif -->

APP版本获取

data() {
  return {
    version: '',
  };
},
onLoad() {
    // #ifdef APP-PLUS
    plus.runtime.getProperty(plus.runtime.appid,(wgtinfo)=>{ // 获取APP信息
      console.log(wgtinfo);
      this.version = wgtinfo.version; // 版本号
    })
    // #endif
},

上面代码 wgtinfo 包括如下信息

 {
    "appid": "HBuilder",
    "version": "1.0.5",
    "name": "APP名称",
    "versionCode": "105",
    "description": "APP描述",
    "author": "",
    "email": "",
    "features": ["uninview"]
}