Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DC-TOM
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘照晖
DC-TOM
Commits
c2dcbe65
Commit
c2dcbe65
authored
May 28, 2025
by
Cai Wei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(*): 修改打包
parent
64353761
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
31 deletions
+42
-31
menuCom.vue
src/layout/menuCom.vue
+28
-8
main.js
src/main.js
+3
-0
vite.config.js
vite.config.js
+11
-23
No files found.
src/layout/menuCom.vue
View file @
c2dcbe65
...
...
@@ -19,7 +19,7 @@
>
<template
#
title
>
<!--
<el-icon><location
/></el-icon>
-->
<img
class=
"menu-icon"
:src=
"
`@/assets/menu/$
{item.meta.icon}.png`
" alt="">
<img
class=
"menu-icon"
:src=
"
getIcon(item.meta.icon)
"
alt=
""
>
<span>
{{
getMenuTitle
(
item
)
}}
</span>
</
template
>
<el-menu-item
...
...
@@ -37,7 +37,7 @@
class=
"submenu-box"
>
<!-- <el-icon><setting /></el-icon> -->
<img
class=
"menu-icon"
:src=
"
`@/assets/menu/${item.meta.icon}.png`
"
alt=
""
>
<img
class=
"menu-icon"
:src=
"
getIcon(item.meta.icon)
"
alt=
""
>
<span>
{{getMenuTitle(item)}}
</span>
</el-menu-item>
</template>
...
...
@@ -48,16 +48,18 @@
<
script
setup
>
import
{
computed
,
ref
,
onMounted
}
from
'vue'
;
import
{
Document
,
Menu
as
IconMenu
,
Location
,
Setting
,
}
from
"@element-plus/icons-vue"
;
import
{
routes
}
from
"../router/index.js"
;
import
{
useRoute
,
useRouter
}
from
'vue-router'
;
import
{
menuStore
}
from
'@/pinia/menu.js'
;
import
{
storeToRefs
}
from
'pinia'
;
import
closeIcon
from
'@/assets/menu/closeIcon.png'
;
import
collectorList
from
'@/assets/menu/collectorList.png'
;
import
dashboard
from
'@/assets/menu/dashboard.png'
;
import
deviceManage
from
'@/assets/menu/deviceManage.png'
;
import
dustOverview
from
'@/assets/menu/dustOverview.png'
;
import
monitor
from
'@/assets/menu/monitor.png'
;
import
warnning
from
'@/assets/menu/warnning.png'
;
const
route
=
useRoute
();
const
router
=
useRouter
();
...
...
@@ -66,6 +68,24 @@ const { sidebar } = storeToRefs(menuStore());
const
routerList
=
routes
[
0
].
children
;
const
menuListData
=
ref
(
JSON
.
parse
(
sessionStorage
.
getItem
(
"menuList"
))
||
[]);
const
getIcon
=
(
iconName
)
=>
{
switch
(
iconName
)
{
case
'closeIcon'
:
return
closeIcon
;
case
'collectorList'
:
return
collectorList
;
case
'dashboard'
:
return
dashboard
;
case
'deviceManage'
:
return
deviceManage
;
case
'dustOverview'
:
return
dustOverview
;
case
'monitor'
:
return
monitor
;
case
'warnning'
:
return
warnning
;
}
}
// 递归过滤路由
const
filterRoutes
=
(
routes
)
=>
{
if
(
!
routes
)
return
[];
...
...
src/main.js
View file @
c2dcbe65
...
...
@@ -10,6 +10,9 @@ import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import
{
createPinia
}
from
"pinia"
;
import
moment
from
'moment'
;
import
{
startPermissionCheck
}
from
'@/utils/permissionChecker'
;
import
"@/assets/tailwindcss/index.js"
import
"@/assets/tailwindcss/index.css"
const
app
=
createApp
(
App
);
for
(
const
[
key
,
component
]
of
Object
.
entries
(
ElementPlusIconsVue
))
{
...
...
vite.config.js
View file @
c2dcbe65
...
...
@@ -16,34 +16,22 @@ export default defineConfig(({mode}) => {
}
},
build
:
{
outDir
:
'dist'
,
assetsInlineLimit
:
4096
,
// 小于4kb的资源将被内联为base64
emptyOutDir
:
true
,
// 构建前清空输出目录
outDir
:
'dist'
,
// 指定输出目录
assetsDir
:
'assets'
,
// 指定静态资源存放目录
sourcemap
:
false
,
// 不生成 sourcemap 文件
chunkSizeWarningLimit
:
1500
,
// 文件大小警告的限制(kbs)
rollupOptions
:
{
output
:
{
manualChunks
:
{
vendor
:
[
'vue'
,
'vue-router'
,
'pinia'
],
ui
:
[
'element-plus'
,
'@element-plus/icons-vue'
]
},
chunkFileNames
:
'static/js/[name]-[hash].js'
,
entryFileNames
:
'static/js/[name]-[hash].js'
,
assetFileNames
:
(
assetInfo
)
=>
{
const
info
=
assetInfo
.
name
.
split
(
'.'
);
let
extType
=
info
[
info
.
length
-
1
];
if
(
/
\.(
png|jpe
?
g|gif|svg|webp|ico
)(\?
.*
)?
$/
.
test
(
assetInfo
.
name
))
{
extType
=
'img'
;
}
else
if
(
/
\.(
woff2
?
|eot|ttf|otf
)(\?
.*
)?
$/i
.
test
(
assetInfo
.
name
))
{
extType
=
'fonts'
;
}
else
if
(
/
\.(
mp4|webm|ogg|mp3|wav|flac|aac
)(\?
.*
)?
$/
.
test
(
assetInfo
.
name
))
{
extType
=
'media'
;
chunkFileNames
:
'assets/js/[name]-[hash].js'
,
entryFileNames
:
'assets/js/[name]-[hash].js'
,
assetFileNames
:
'assets/[ext]/[name]-[hash].[ext]'
,
manualChunks
(
id
)
{
if
(
id
.
includes
(
'node_modules'
))
{
return
'vendor'
}
return
`static/
${
extType
}
/[name]-[hash][extname]`
;
}
}
},
// 确保 assets 目录下的资源被复制到构建目录
assetsDir
:
'static'
,
copyPublicDir
:
true
}
},
server
:
{
host
:
'0.0.0.0'
,
// 指定服务器主机名
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment