diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ad1ba07..8c47a80 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,7 +4,23 @@ { "recommendations": [ - "Vue.volar", // Vue语言支持扩展 + "afzalsayed96.icones", + "antfu.iconify", + "antfu.unocss", + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig", + "esbenp.prettier-vscode", + "formulahendry.auto-close-tag", + "formulahendry.auto-complete-tag", + "formulahendry.auto-rename-tag", + "lokalise.i18n-ally", + "mhutchie.git-graph", + "mikestead.dotenv", + "naumovs.color-highlight", + "pkief.material-icon-theme", + "sdras.vue-vscode-snippets", + "whtouche.vscode-js-console-utils", + "zhuangtongfa.material-theme", "Vue.vscode-typescript-vue-plugin", // 一个TS服务器插件,使TS服务器知道*.vue文件。 "esbenp.prettier-vscode", // 代码格式化 "dbaeumer.vscode-eslint" // 代码质量检查 diff --git a/.vscode/settings.json b/.vscode/settings.json index 57425c6..aced40f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,73 +1,185 @@ -//////////////////////////////////////////////////////////////////////////// -// vscode 编辑器和插件的配置 //////////////////////////////////////////////// -// 参考:https://blog.csdn.net/weixin_46238462/article/details/125867532 // -////////////////////////////////////////////////////////////////////////// - { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.detectIndentation": false, - "editor.tabSize": 4, - "files.eol": "auto", - "eslint.enable": true, - - ////////////////////////////////////////////////////////////////// - // 官网参考:https://prettier.io/docs/en/options.html#tab-width // - //////////////////////////////////////////////////////////////// - "prettier.semi": true, - "prettier.tabWidth": 4, - "prettier.printWidth": 160, - "prettier.endOfLine": "auto", - "prettier.singleQuote": true, - "prettier.ignorePath": ".prettierignore", - // Enable the ESlint flat config support - // (remove this if your ESLint extension above v3.0.5) - "eslint.experimental.useFlatConfig": true, - - // Disable the default formatter, use eslint instead - "prettier.enable": false, - "editor.formatOnSave": false, - - // Auto fix + // "editor.codeActionsOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.organizeImports": "never" }, - - // Silent the stylistic rules in you IDE, but still auto fix them - "eslint.rules.customizations": [ - { "rule": "style/*", "severity": "off" }, - { "rule": "format/*", "severity": "off" }, - { "rule": "*-indent", "severity": "off" }, - { "rule": "*-spacing", "severity": "off" }, - { "rule": "*-spaces", "severity": "off" }, - { "rule": "*-order", "severity": "off" }, - { "rule": "*-dangle", "severity": "off" }, - { "rule": "*-newline", "severity": "off" }, - { "rule": "*quotes", "severity": "off" }, - { "rule": "*semi", "severity": "off" } + "eslint.experimental.useFlatConfig": true, + "editor.formatOnSave": false, + "prettier.enable": false, + "unocss.root": ["./"], + "typescript.tsdk": "node_modules/typescript/lib", + "vue.server.hybridMode": true, + "eslint.validate": ["html", "css", "scss", "json", "jsonc"], + "i18n-ally.displayLanguage": "zh-cn", + "i18n-ally.enabledParsers": ["ts"], + "i18n-ally.enabledFrameworks": ["vue"], + "i18n-ally.editor.preferEditor": true, + "i18n-ally.keystyle": "nested", + "i18n-ally.localesPaths": ["src/locales/langs"], + "editor.fontLigatures": true, + "editor.quickSuggestions": { + "strings": true + }, + "editor.tabSize": 2, + "files.associations": { + "*.env.*": "dotenv", + "*.svg": "html" + }, + // "files.refactoring.autoSave": false, + "files.eol": "\n", + "path-intellisense.mappings": { + "@": "${workspaceFolder}/src", + "~@": "${workspaceFolder}/src" + }, + "terminal.integrated.fontSize": 14, + "terminal.integrated.fontWeight": 500, + "terminal.integrated.tabs.enabled": true, + // "workbench.iconTheme": "material-icon-theme", + "workbench.colorTheme": "Visual Studio Light", + "css.lint.unknownAtRules": "ignore", + "psi-header.config": { + "forceToTop": true, + "blankLinesAfter": 3, + "license": "Custom" + }, + "psi-header.changes-tracking": { + "isActive": true, + "modAuthor": "Modified By: ", + "modDate": "Last Modified: ", + "modDateFormat": "date", + "include": [], + "exclude": ["markdown", "json"], + "excludeGlob": ["out/**", "src/**/*.xyz", "components/**/*.mk"], + "autoHeader": "manualSave" + }, + "psi-header.license-text": ["May the force be with you."], + "psi-header.variables": [ + ["company", "self."] + // ["author", "你的名字 - 默认主机名"], + // ["authoremail", "xxxxx@gmail.com"], + // ["initials", "S.L"] ], - - // Enable eslint for all supported languages - "eslint.validate": [ - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - "vue", - "html", - "markdown", - "json", - "jsonc", - "yaml", - "toml", - "xml", - "gql", - "graphql", - "astro", - "css", - "less", - "scss", - "pcss", - "postcss" + "psi-header.lang-config": [ + { + "language": "html", + "begin": "", + "prefix": " " + }, + { + "language": "vue", + "begin": "", + "prefix": " " + }, + { + "language": "lua", + "begin": "--[[", + "prefix": "--", + "end": "--]]", + "blankLinesAfter": 0 + }, + { + "language": "python", + "begin": "###", + "prefix": "# ", + "end": "###", + "blankLinesAfter": 0, + "beforeHeader": ["#!/usr/bin/env python", "# -*- coding:utf-8 -*-"] + }, + { + "language": "javascript", + "begin": "/**", + "prefix": " * ", + "end": " */", + "blankLinesAfter": 0, + "forceToTop": true + }, + { + "language": "typescript", + "mapTo": "javascript", + "begin": "/**", + "prefix": " * ", + "end": " */", + "blankLinesAfter": 0, + "forceToTop": true + } + ], + "psi-header.templates": [ + { + "language": "javascript", + "template": [ + "## File: <>", + "", + "Project: <>", + "", + "Created Date: <>", + "", + "Author: <>", + "", + "## Last Modified: <>", + "", + "Modified By: ", + "", + "## Copyright (c) <> <>", + "", + "Use To: " + ] + }, + { + "language": "typescript", + "template": [ + "## File: <>", + "", + "Project: <>", + "", + "Created Date: <>", + "", + "Author: <>", + "", + "## Last Modified: <>", + "", + "Modified By: ", + "", + "## Copyright (c) <> <>", + "", + "Use To: " + ] + }, + { + "language": "html", + "begin": "", + "template": [ + "## File: <>", + "", + "Project: <>", + "", + "Created Date: <>", + "", + "Author: <>", + "", + "## Last Modified: <>", + "", + "Modified By: ", + "", + "## Copyright (c) <> <>", + "", + "Use To: " + ] + }, + { + "language": "typescript", + "mapTo": "javascript" + }, + { + "language": "tsx", + "mapTo": "javascript" + }, + { + "language": "vue", + "mapTo": "html" + } ] } diff --git a/README.md b/README.md index ad94989..1e690bc 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,19 @@

+## appProvider 插件 + +- ./vite/plugins/appProvider.ts +- 本配置功能为扫描 @/pages/xx/index.vue 文件,通过覆盖一层 view 的方式注入 style 变量 +- 相关文件 `./src/layout/AppProvider.vue` + +## vite/plugins/build.unocss.config.ts - 构建 unocss 相关配置 + +- 本配置通过读取 ./src/theme/theme.ts 文件中相关配置构建 **theme 变量 , **theme 即 AppProvider.vue 文件的 style 变量 +- 相关文件 `./src/theme/theme.ts` + `./src/stores/modules/system.ts` + `./src/mixins/theme.ts` + ## 简介 - **uni-app Vue3 Vite4 pinia2 TypeScript 基础框架** diff --git a/package.json b/package.json index 14568e8..d2b2cf3 100644 --- a/package.json +++ b/package.json @@ -51,10 +51,14 @@ "@dcloudio/uni-mp-weixin": "3.0.0-alpha-4010920240607001", "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4010920240607001", "@multiavatar/multiavatar": "^1.0.7", + "@unocss/transformer-directives": "^0.61.0", "alova": "^2.21.3", "crypto-js": "^4.2.0", "lodash-es": "^4.17.21", + "normalize-path": "^3.0.0", "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^3.2.1", + "unplugin-vue-components": "^0.27.0", "vue": "^3.4.29" }, "devDependencies": { @@ -68,6 +72,7 @@ "@types/crypto-js": "^4.2.2", "@types/lodash-es": "^4.17.12", "@types/node": "^20.14.2", + "@types/normalize-path": "^3.0.0", "@unocss/eslint-plugin": "^0.61.0", "@vitejs/plugin-vue": "^5.0.5", "@vue/runtime-core": "^3.4.29", diff --git a/src/App.vue b/src/App.vue index 735c9d7..4dfb86b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,13 +1,13 @@