● fix: 修复 Vite 8 前端编译及运行时错误
- main.js: 修复 createApp/mount 缺失导致 app 未定义 - chineseMedicineDialog: defineModel → props+emit 兼容 Vue 3.5 - el-form-nan-plugin: 修正 try/catch 括号匹配 - vite.config: CSS 压缩器切换为 esbuild
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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);',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:model-value="visible"
|
||||
@update:model-value="emit('update:visible', $event)"
|
||||
title="中医诊断"
|
||||
:width="width"
|
||||
:z-index="20"
|
||||
@@ -98,15 +99,17 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['ok-act'])
|
||||
|
||||
const visible = defineModel<boolean>('visible')
|
||||
const emit = defineEmits(['ok-act', 'update:visible'])
|
||||
const width = '500px'
|
||||
|
||||
const cancelAct = () => {
|
||||
visible.value = false
|
||||
emit('update:visible', false)
|
||||
}
|
||||
|
||||
function handleConditionChange() {
|
||||
@@ -175,7 +178,7 @@ const openAct = () => {
|
||||
loadSyndromeOptions()
|
||||
}
|
||||
const closedAct = () => {
|
||||
visible.value = false
|
||||
emit('update:visible', false)
|
||||
}
|
||||
onMounted(() => {
|
||||
loadConditionOptions()
|
||||
|
||||
@@ -55,6 +55,9 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
cssMinify: 'esbuild',
|
||||
},
|
||||
//fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
|
||||
Reference in New Issue
Block a user