mod vue2 to vue3
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" href="/favicon.png">
|
||||
<title>图书管理系统</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+3646
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
// Variables exported as JS object for Vite compatibility
|
||||
// Original source: variables.scss :export block
|
||||
export default {
|
||||
menuText: '#bfcbd9',
|
||||
menuActiveText: '#409EFF',
|
||||
subMenuActiveText: '#f4f4f5',
|
||||
menuBg: '#304156',
|
||||
menuHover: '#263445',
|
||||
subMenuBg: '#1f2d3d',
|
||||
subMenuHover: '#001528',
|
||||
sideBarWidth: '210px'
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 简易路径解析工具,替代 Node.js path 模块(Vite 不提供 Node polyfill)
|
||||
* 用法: resolve('/sys', 'config') => '/sys/config'
|
||||
*/
|
||||
export function resolve(...segments) {
|
||||
let joined = segments.join('/')
|
||||
// 去除重复斜杠
|
||||
joined = joined.replace(/\/+/g, '/')
|
||||
// 确保以 / 开头
|
||||
if (!joined.startsWith('/')) joined = '/' + joined
|
||||
// 去除末尾斜杠(除非就是根路径)
|
||||
if (joined.length > 1 && joined.endsWith('/')) joined = joined.slice(0, -1)
|
||||
return joined
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||
import path from 'path'
|
||||
|
||||
const resolve = (dir) => path.resolve(__dirname, dir)
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
vue(),
|
||||
createSvgIconsPlugin({
|
||||
iconDirs: [resolve('src/icons/svg')],
|
||||
symbolId: 'icon-[name]'
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src')
|
||||
}
|
||||
},
|
||||
define: {
|
||||
'process.env': {}
|
||||
},
|
||||
server: {
|
||||
port: 9527,
|
||||
open: true
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
assetsDir: 'static',
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
chunkFileNames: 'static/js/[name]-[hash].js',
|
||||
entryFileNames: 'static/js/[name]-[hash].js',
|
||||
assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
|
||||
manualChunks(id) {
|
||||
if (id.includes('node_modules')) {
|
||||
if (id.includes('element-plus')) {
|
||||
return 'chunk-elementPlus'
|
||||
}
|
||||
return 'chunk-libs'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
charset: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user