From ba839a1e470d6ece545e150b1f0c95fb1e59dc01 Mon Sep 17 00:00:00 2001 From: yuantao Date: Mon, 1 Dec 2025 16:03:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=8A=9F=E8=83=BD=E5=A2=9E=E5=8A=A0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=90=8D=E7=A7=B0=E5=92=8C=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/utils/tool.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/common/utils/tool.js b/common/utils/tool.js index a393ffd..75206a2 100644 --- a/common/utils/tool.js +++ b/common/utils/tool.js @@ -33,9 +33,9 @@ class Tool { // 项目信息 this.projectInfo = { name: 'template', - version: '1.0.0' + version: '1.0.0', } - + // 尝试从 manifest.json 加载项目信息 this._loadProjectInfo() } @@ -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) { // 如果加载失败,使用默认信息