fix: 打包

This commit is contained in:
zhangguoping 2024-06-19 22:30:09 +08:00
parent 33f008b620
commit aa24ed9f3e
3 changed files with 12 additions and 5 deletions

2
env/.env vendored
View File

@ -5,7 +5,7 @@ VITE_UNI_APPID = 'H57F2ACE4'
VITE_WX_APPID = 'wxa2abb91f64032a2b'
# h5部署网站的base配置到 manifest.config.ts 里的 h5.router.base
VITE_APP_PUBLIC_BASE = ./
VITE_APP_PUBLIC_BASE = 'test'
# VITE_SERVER_BASEURL = 'https://gateway.dev.cdlsxd.cn'
VITE_SERVER_BASEURL = 'https://gateway.dev.cdlsxd.cn'

View File

@ -24,6 +24,7 @@ export default defineManifestConfig({
locale: VITE_FALLBACK_LOCALE, // 'zh-Hans'
h5: {
router: {
mode: 'history',
base: VITE_APP_PUBLIC_BASE,
},
},

View File

@ -43,11 +43,17 @@ const srcList = reactive<SrcListType>({
const getUrlPathName = () => {
const url = window.location.href
const str = url.split('#/')[1]
if (str.indexOf('/') === -1) {
return str || ''
if (url.indexOf('#/') !== -1) {
const str =
url.indexOf('#/') !== -1 ? url.split('#/')[1] : url.split('/')[url.split('/').length - 1]
if (str.indexOf('/') === -1) {
return str || ''
} else {
return str.split('/')[0]
}
} else {
return str.split('/')[0]
const strP = url.split('/')
return strP[strP.length - 1]
}
}