# vmd **Repository Path**: neo5simple/vmd ## Basic Information - **Project Name**: vmd - **Description**: start new Vue+MDUI - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-08 - **Last Updated**: 2025-11-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # VMD Vue + MDUI 起手式 ## 项目配置 依赖环境 - [Node.js][node]:JavaScript 运行时引擎,建议 v22+ 版本 建议使用 - [NVM][nvm]:Node 版本管理器 - [Visual Studio Code][code]:代码编辑器 安装项目依赖库 ```sh npm i ``` ### 编译并开始调试 ```sh npm run dev ``` ### 构建生产版本 ```sh npm run build ``` ## 开发文档 - [Vue.js][vue]:Web 前端用户界面框架 - [MDUI][mdui]:遵循 Material Design 3 的组件库 ## 实践指南 基于 `vite.config.js` 配置 ### 依赖空间可视化 ```js plugins: [visualizer()]; ``` 编译后会在跟目录下生成可视化文件 `stat.html` ### 代码分块 例如基于模块名称分块 ```js rollupOptions: { output: { manualChunks(id) { if (id.includes("node_modules")) { return id .toString() .split("node_modules/")[1] .split("/")[0] .toString(); } }, }, }, ``` ### 代码压缩 需确保服务器提供了压缩服务,例如 Nginx ```conf gzip on; gzip_static on; ``` 压缩配置 ```js plugins: [ compression({ verbose: true, disable: false, threshold: 32 * 1024, algorithm: "gzip", ext: "gz", }), ]; ``` ### 依赖更新 ```sh npm i -g npm-check-updates ncu -u npm i ``` ### 清理多余的依赖 ```sh npm prune ``` ## UI 原则 ### 颜色 默认使用蓝色作为主题色,设置颜色的同时,生成特殊的红、绿、蓝和黄色 ```js const rgb = "#00F"; setColorScheme(rgb, { customColors: [ { name: "red", value: "#800", }, { name: "green", value: "#080", }, { name: "blue", value: "#008", }, { name: "yellow", value: "#760", }, ], }); ``` 示例类颜色 ```css .red-text { color: rgb(var(--mdui-color-red)); } .green-text { color: rgb(var(--mdui-color-green)); } .blue-text { color: rgb(var(--mdui-color-blue)); } .yellow-text { color: rgb(var(--mdui-color-yellow)); } .red-button { color: rgb(var(--mdui-color-on-red)); background-color: rgb(var(--mdui-color-red)); } .green-button { color: rgb(var(--mdui-color-on-green)); background-color: rgb(var(--mdui-color-green)); } .blue-button { color: rgb(var(--mdui-color-on-blue)); background-color: rgb(var(--mdui-color-blue)); } .yellow-button { color: rgb(var(--mdui-color-on-yellow)); background-color: rgb(var(--mdui-color-yellow)); } .red-chip { color: rgb(var(--mdui-color-on-red-container)); background-color: rgb(var(--mdui-color-red-container)); } .green-chip { color: rgb(var(--mdui-color-on-green-container)); background-color: rgb(var(--mdui-color-green-container)); } .blue-chip { color: rgb(var(--mdui-color-on-blue-container)); background-color: rgb(var(--mdui-color-blue-container)); } .yellow-chip { color: rgb(var(--mdui-color-on-yellow-container)); background-color: rgb(var(--mdui-color-yellow-container)); } ``` 设计图颜色对应关系 - 默认文本:`rgb(var(--mdui-color-on-surface))` - 默认浅色文本:`rgb(var(--mdui-color-on-surface-variant))` - 默认蓝色文本:`rgb(var(--mdui-color-primary))` - 默认背景:`rgb(var(--mdui-color-background))` - 默认选中背景:`rgb(var(--mdui-color-secondary-container))` - 默认错误文本:`rgb(var(--mdui-color-error))` 未匹配的颜色使用方法 ```html
| 学号 | 姓名 | 性别 | 年龄 | 班级 |
|---|---|---|---|---|
| 20240001 | 张三 | 男 | 18 | 高一(1)班 |