打包修复

This commit is contained in:
dqz 2025-03-11 08:56:34 +08:00
parent be76c9ccc4
commit db4b454898
9 changed files with 13 additions and 7 deletions

2
.env
View File

@ -1,7 +1,7 @@
# 所有环境的环境变量(命名必须以 VITE_ 开头)
## 项目标题
VITE_APP_TITLE = MobVue
VITE_APP_TITLE = 微商店
## 路由模式 hash 或 html5
VITE_ROUTER_HISTORY = hash

View File

@ -1,7 +1,6 @@
# 生产环境的环境变量(命名必须以 VITE_ 开头)
## 后端接口地址(如果解决跨域问题采用 CORS 就需要写绝对路径)
VITE_BASE_URL = https://apifoxmock.com/m1/2930465-2145633-default/api/v1
VITE_BASE_URL = '/shop-api/api'
## 打包构建静态资源公共路径(例如部署到 https://un-pany.github.io/mobvue/ 域名下就需要填写 /mobvue/
VITE_PUBLIC_PATH = /mobvue/
VITE_PUBLIC_PATH = /shop/

View File

@ -50,5 +50,9 @@
"pcss",
"postcss"
],
"marscode.chatLanguage": "cn"
"marscode.chatLanguage": "cn",
"marscode.codeCompletionPro": {
"enableCodeCompletionPro": true
},
"marscode.enableInlineCommand": true
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 32 KiB

BIN
public/favicon1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
public/favicon2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

1
src/common/utils/path.ts Normal file
View File

@ -0,0 +1 @@
export const publicPath = import.meta.env.BASE_URL

View File

@ -1,4 +1,5 @@
<script setup lang="ts">
import { publicPath } from "@/common/utils/path"
import { useCartStore } from "@/pinia/stores/cart"
import { useProductStore } from "@/pinia/stores/product"
import { throttle } from "lodash-es"
@ -118,7 +119,7 @@ function handleCheckout() {
<template>
<div class="shop">
<div class="shop-header" :style="{ height: `${headerHeight}px` }">
<van-image src="/c63.jpg" class="shop-cover" fit="cover" />
<van-image :src="`${publicPath}c63.jpg`" class="shop-cover" fit="cover" />
</div>
<div class="product-container">
<!-- 左侧分类导航 -->

View File

@ -21,7 +21,8 @@ export default defineConfig(({ mode }) => {
// @ 符号指向 src 目录
"@": resolve(__dirname, "src"),
// @@ 符号指向 src/common 通用目录
"@@": resolve(__dirname, "src/common")
"@@": resolve(__dirname, "src/common"),
"@img": resolve(__dirname, "src/assets/images")
}
},
// 开发环境服务器配置