From 7ca0b89cb25cfda10cab96a1f28fef1d411e0bce Mon Sep 17 00:00:00 2001 From: wangjian963 <15215920+aprilry@user.noreply.gitee.com> Date: Wed, 3 Jun 2026 13:09:04 +0800 Subject: [PATCH] =?UTF-8?q?=E2=97=8F=20fix:=20=E4=BF=AE=E5=A4=8D=20Vite=20?= =?UTF-8?q?8=20=E5=89=8D=E7=AB=AF=E7=BC=96=E8=AF=91=E5=8F=8A=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - main.js: 修复 createApp/mount 缺失导致 app 未定义 - chineseMedicineDialog: defineModel → props+emit 兼容 Vue 3.5 - el-form-nan-plugin: 修正 try/catch 括号匹配 - vite.config: CSS 压缩器切换为 esbuild --- openhis-ui-vue3/src/main.js | 7 +++++-- openhis-ui-vue3/src/patches/el-form-nan-plugin.js | 6 ++++-- .../diagnosis/chineseMedicineDialog.vue | 15 +++++++++------ openhis-ui-vue3/vite.config.js | 3 +++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/openhis-ui-vue3/src/main.js b/openhis-ui-vue3/src/main.js index 410b933c9..5e288b493 100755 --- a/openhis-ui-vue3/src/main.js +++ b/openhis-ui-vue3/src/main.js @@ -1,4 +1,4 @@ -import {createApp} from 'vue'; +import {createApp, nextTick} from 'vue'; import VxeUIAll from 'vxe-table'; import 'vxe-table/lib/style.css'; @@ -104,6 +104,8 @@ console.error = (...args) => { _origError.apply(console, args); }; +const app = createApp(App); + // 全局方法挂载 app.config.globalProperties.useDict = useDict; app.config.globalProperties.download = download; @@ -165,7 +167,8 @@ window.addEventListener("error", (e) => { }, true); // 应用启动后初始化公告弹窗功能 -import { nextTick } from 'vue' nextTick(() => { initNoticePopupAfterLogin() }) + +app.mount('#app') diff --git a/openhis-ui-vue3/src/patches/el-form-nan-plugin.js b/openhis-ui-vue3/src/patches/el-form-nan-plugin.js index 126e872e9..0fd5e61e4 100644 --- a/openhis-ui-vue3/src/patches/el-form-nan-plugin.js +++ b/openhis-ui-vue3/src/patches/el-form-nan-plugin.js @@ -20,9 +20,11 @@ export default function patchElFormNan() { .replace('const updateLabelWidth = (action = \"update\") => {', 'let _isMounted = true;\n\tconst updateLabelWidth = (action = \"update\") => {') .replace('nextTick(() => {', - 'nextTick(() => {\n\t\t\t\tif (!_isMounted) return;\n\t\t\t\ttry {') + 'nextTick(() => {\n\t\t\t\tif (!_isMounted) return;') + .replace('if (slots.default && props.isAutoWidth) {', + 'try {\n\t\t\t\tif (slots.default && props.isAutoWidth) {') .replace('else if (action === \"remove\") formContext?.deregisterLabelWidth(computedWidth.value);', - 'else if (action === \"remove\") formContext?.deregisterLabelWidth(computedWidth.value);\n\t\t\t\t} catch (e) { /* teardown race */ }') + 'else if (action === \"remove\") formContext?.deregisterLabelWidth(computedWidth.value);\n\t\t\t\t}\n\t\t\t} catch (e) { /* teardown race */ }') .replace('onBeforeUnmount(() => {', 'onBeforeUnmount(() => {\n\t\t\t_isMounted = false;') .replace('onUpdated(() => updateLabelWidthFn())', 'onUpdated(() => { if (_isMounted) updateLabelWidthFn(); })') .replace('if (props.updateAll) formContext?.registerLabelWidth(val, oldVal);', diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/chineseMedicineDialog.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/chineseMedicineDialog.vue index e7b32fd5b..2138c01c2 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/chineseMedicineDialog.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/diagnosis/chineseMedicineDialog.vue @@ -1,6 +1,7 @@