Files
sale/frontend/src/components.d.ts
T
admin ea6835a3dd
Build and Push Docker Image / build-and-push (push) Failing after 19s
Build and Push Docker Image / deploy (push) Skipped
perf(frontend): Element Plus 按需引入 + 修 baseURL 硬编码 + 修正响应取值
一、Element Plus 改为按需引入
  原来 main.ts 里 app.use(ElementPlus) 全量注册,加上 37 个文件里的
  import { ElMessage } from 'element-plus' 从包入口引入,整个组件库被打进
  主包(1,165 kB / gzip 384 kB)。

  vite.config.ts 接入 unplugin-vue-components + unplugin-auto-import,
  manualChunks 把运行时拆成四块:
    index(业务)      30.63 kB  gzip   9.94 kB
    vue-vendor       173.55 kB  gzip  62.77 kB
    vendor           189.69 kB  gzip  69.74 kB
    element-plus     795.44 kB  gzip 249.88 kB

  39 处 import 从 'element-plus' 改到具体组件路径
  (element-plus/es/components/message/index 等)。核查产物确认未使用的
  组件(el-transfer / el-cascader / el-tree-select / el-color-picker)
  已不再打入。项目实际使用 42 个组件,795 kB 是真实用量,不是打包失控。

  ElMessage / ElMessageBox / ElLoading 是函数式 API,不走 auto-import,
  样式在 main.ts 显式引入,否则弹窗和遮罩会没样式。

二、修 baseURL 硬编码(这个是既有严重问题)
  utils/request.ts: baseURL 原为 'http://localhost:8080/api'。
  部署到公网后浏览器会去请求用户自己的 localhost:8080,API 全部失败。
  改为 '/api':生产由后端同源提供,本地 dev 由 vite proxy 转发。

三、修正响应取值
  utils/request.ts 的响应拦截器已经 return response.data(解包一层),
  所以 await api.get(...) 得到的就是响应体,res.data 才是业务数据。
  本次新写的四个页面误写成 res.data.data(多取一层,全是 undefined):
    supplier/Dashboard.vue、supplier/Inventory.vue、
    supplier/Products.vue、user/OrderDetail.vue
  已全部改回 res.data。已全量扫描,项目内不再有 .data.data 多层取值。

四、SupplierProducts 补 effective_price
  供货商商品列表原来只显示基础价,促销价/会员价配了看不出来。

浏览器实测(不是只编译):
  首页/安装页       el-button el-input el-form 正常渲染
  后台商品页        el-table 8 列表头 + el-pagination + 18 个菜单项
  创建商品对话框    el-dialog/el-date-picker×4/el-input-number×8/el-upload/
                    el-switch×2/el-select×3,表单含「促销价/促销时间/会员价」
  供货商控制台      销售额 ¥160.00、订单 1、已售 2 件、状态分布「已发货 1」、
                    补货提醒 1 条(UI测试商品 剩 3 阈值 5)
  供货商库存页      SKU 1 / 库存总量 3 / 低库存 1 / 全局阈值 10,低库存行高亮
  供货商我的商品    分类、售价、我的库存 3、在售状态、维护库存
  订单详情          物流时间线「顺丰速运 SF9988776655 / 商家已发货」,
                    商品明细 2 × ¥80 = ¥160.00(促销价生效)
2026-11-19 07:31:18 +08:00

64 lines
3.1 KiB
TypeScript

/* eslint-disable */
// @ts-nocheck
// biome-ignore lint: disable
// oxlint-disable
// ------
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
BackNav: typeof import('./components/BackNav.vue')['default']
ElAlert: typeof import('element-plus/es')['ElAlert']
ElAvatar: typeof import('element-plus/es')['ElAvatar']
ElButton: typeof import('element-plus/es')['ElButton']
ElCarousel: typeof import('element-plus/es')['ElCarousel']
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCol: typeof import('element-plus/es')['ElCol']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElStep: typeof import('element-plus/es')['ElStep']
ElSteps: typeof import('element-plus/es')['ElSteps']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElUpload: typeof import('element-plus/es')['ElUpload']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
export interface GlobalDirectives {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}