You've already forked template-MP
新增 错误上报功能增加项目名称和版本号信息
This commit is contained in:
@@ -33,7 +33,7 @@ class Tool {
|
||||
// 项目信息
|
||||
this.projectInfo = {
|
||||
name: 'template',
|
||||
version: '1.0.0'
|
||||
version: '1.0.0',
|
||||
}
|
||||
|
||||
// 尝试从 manifest.json 加载项目信息
|
||||
@@ -826,13 +826,10 @@ class Tool {
|
||||
*/
|
||||
_loadProjectInfo() {
|
||||
try {
|
||||
// 尝试加载 manifest.json 信息
|
||||
const manifest = require('../../manifest.json')
|
||||
if (manifest.name) {
|
||||
this.projectInfo.name = manifest.name
|
||||
}
|
||||
if (manifest.versionName) {
|
||||
this.projectInfo.version = manifest.versionName
|
||||
if (uni.getSystemInfoSync()) {
|
||||
const AppInfo = uni.getSystemInfoSync()
|
||||
this.projectInfo.name = AppInfo.appName
|
||||
this.projectInfo.version = AppInfo.appVersion
|
||||
}
|
||||
} catch (error) {
|
||||
// 如果加载失败,使用默认信息
|
||||
|
||||
Reference in New Issue
Block a user