fix(frontend): Upload.vue 3 处 h('el-button') 改为显式 ElButton(BACKLOG B1)

修复前:Vue3 中 h('el-button') 的字符串标签不解析为组件,创建原生自定义元素
<el-button> ⇒ 无 EP 样式 · type/circle/text 失效 · 「开始上传」的 loading 与
primary 全失效(点击后无进行中反馈)· icon: h(Delete) 被写成垃圾属性。

修法:ElButton 已在同文件 309 行导入 ⇒ 3 处字符串改标识符(ElProgress/ElTag/
ElIcon 已在 R36 迁移)。最小改动:3 insertions / 3 deletions。

验证(新增 perf-r34/upload-check.mjs:静态服务 + 真后端代理 + 真 chromium +
拦截 POST /api/upload/** 防真实写库):
  18/18 全绿 —— 「开始上传」cls='el-button el-button--primary is-loading'
  bg=rgb(26,58,92) == --el-color-primary · 删除按钮 is-circle+el-button--danger ·
  「重新上传」is-text+el-button--danger · 0 个原生 el-button 自定义元素 ·
  0 Failed to resolve · 0 pageerror · 2 个写请求被拦截(零真实写库)
  TDZ 扫描 38 文件 PASS · vite build exit 0

⚠️ 另发现(不在本次修复范围,见 BACKLOG B2):/upload 是全仓零 UI 入口的
孤儿路由,且对中职/高职会调用后端不支持的分组接口(3 条 console 错误)。
This commit is contained in:
2026-09-29 12:01:57 +08:00
parent 86f3b6c28c
commit 0416ac3360

View File

@@ -467,7 +467,7 @@ const FileUploadArea = defineComponent({
// 已选文件 // 已选文件
fileList.value.length > 0 ? h('div', { class: 'selected-file' }, [ fileList.value.length > 0 ? h('div', { class: 'selected-file' }, [
h('span', { class: 'selected-name' }, fileList.value[0].name || fileList.value[0].fileName), h('span', { class: 'selected-name' }, fileList.value[0].name || fileList.value[0].fileName),
h('el-button', { h(ElButton, {
type: 'danger', type: 'danger',
size: 'small', size: 'small',
icon: h(Delete), icon: h(Delete),
@@ -478,7 +478,7 @@ const FileUploadArea = defineComponent({
// 上传按钮 // 上传按钮
fileList.value.length > 0 ? h('div', { class: 'upload-actions' }, [ fileList.value.length > 0 ? h('div', { class: 'upload-actions' }, [
h('el-button', { h(ElButton, {
type: 'primary', type: 'primary',
loading: uploading.value, loading: uploading.value,
onClick: startUpload, onClick: startUpload,
@@ -502,7 +502,7 @@ const FileUploadArea = defineComponent({
h('span', null, formatFileSize(uploadedInfo.value.fileSize)), h('span', null, formatFileSize(uploadedInfo.value.fileSize)),
uploadedInfo.value.md5 ? h('span', null, `MD5: ${uploadedInfo.value.md5.slice(0, 16)}...`) : null, uploadedInfo.value.md5 ? h('span', null, `MD5: ${uploadedInfo.value.md5.slice(0, 16)}...`) : null,
].filter(Boolean)), ].filter(Boolean)),
h('el-button', { h(ElButton, {
text: true, text: true,
type: 'danger', type: 'danger',
size: 'small', size: 'small',