1. 程式人生 > >Cordova專案怎樣獲取專案版本號

Cordova專案怎樣獲取專案版本號

修改版本號

cordova專案下的config.xml中的最上面的widget標籤中的version="1.0.0"中修改

獲取版本號

 if (platform == 'iOS') {
                cordova.getAppVersion.getVersionNumber().then(function (version) {
                  console.log("本地版本:" + version);
                  _this.version='v'+version;
                })
              }

if (platform == 'Android') {
                cordova.getAppVersion.getVersionNumber().then(function (version) {
                  console.log("本地版本:" + version);
                  _this.version='v'+version;
                })
              }