vue3前端项目模板,可以拉下模板写新的项目
songshankun
2023-10-25 666576fefa2371a44b7e84e444e74eed15563039
chore: 配置组件库/图标库/axios
2个文件已删除
9个文件已添加
1 文件已重命名
12个文件已修改
902 ■■■■ 已修改文件
env.d.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json 459 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.vue 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/images/.gitkeep 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/logo.svg 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/main.css 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/styles/base.css 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/styles/main.css 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/auto-imports.d.ts 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/common/composable/index.ts 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/common/constants/index.ts 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/common/utils/index.ts 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/common/utils/request.ts 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components.d.ts 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/HelloWorld.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/AboutView.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/HomeView.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
tsconfig.app.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
tsconfig.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
tsconfig.node.json 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.ts 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
env.d.ts
@@ -1 +1,7 @@
/// <reference types="vite/client" />
/// <reference types="unplugin-icons/types/vue" />
declare module '~icons/*' {
  import { FunctionalComponent, SVGAttributes } from 'vue'
  const component: FunctionalComponent<SVGAttributes>
  export default component
}
package-lock.json
@@ -8,7 +8,9 @@
      "name": "basic-vue3-template",
      "version": "0.0.0",
      "dependencies": {
        "@element-plus/icons-vue": "^2.1.0",
        "@vueuse/core": "^10.5.0",
        "axios": "^1.5.1",
        "element-plus": "^2.4.1",
        "lodash-es": "^4.17.21",
        "pinia": "^2.1.7",
@@ -16,6 +18,7 @@
        "vue-router": "^4.2.5"
      },
      "devDependencies": {
        "@iconify-json/mdi": "^1.1.55",
        "@rushstack/eslint-patch": "^1.3.3",
        "@tsconfig/node18": "^18.2.2",
        "@types/node": "^18.18.6",
@@ -32,6 +35,7 @@
        "sass": "^1.69.4",
        "typescript": "~5.2.0",
        "unplugin-auto-import": "^0.16.6",
        "unplugin-icons": "^0.17.1",
        "unplugin-vue-components": "^0.25.2",
        "vite": "^4.4.11",
        "vue-tsc": "^1.8.19"
@@ -44,6 +48,96 @@
      "dev": true,
      "engines": {
        "node": ">=0.10.0"
      }
    },
    "node_modules/@antfu/install-pkg": {
      "version": "0.1.1",
      "resolved": "https://registry.npmmirror.com/@antfu/install-pkg/-/install-pkg-0.1.1.tgz",
      "integrity": "sha512-LyB/8+bSfa0DFGC06zpCEfs89/XoWZwws5ygEa5D+Xsm3OfI+aXQ86VgVG7Acyef+rSZ5HE7J8rrxzrQeM3PjQ==",
      "dev": true,
      "dependencies": {
        "execa": "^5.1.1",
        "find-up": "^5.0.0"
      }
    },
    "node_modules/@antfu/install-pkg/node_modules/execa": {
      "version": "5.1.1",
      "resolved": "https://registry.npmmirror.com/execa/-/execa-5.1.1.tgz",
      "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
      "dev": true,
      "dependencies": {
        "cross-spawn": "^7.0.3",
        "get-stream": "^6.0.0",
        "human-signals": "^2.1.0",
        "is-stream": "^2.0.0",
        "merge-stream": "^2.0.0",
        "npm-run-path": "^4.0.1",
        "onetime": "^5.1.2",
        "signal-exit": "^3.0.3",
        "strip-final-newline": "^2.0.0"
      },
      "engines": {
        "node": ">=10"
      }
    },
    "node_modules/@antfu/install-pkg/node_modules/human-signals": {
      "version": "2.1.0",
      "resolved": "https://registry.npmmirror.com/human-signals/-/human-signals-2.1.0.tgz",
      "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
      "dev": true,
      "engines": {
        "node": ">=10.17.0"
      }
    },
    "node_modules/@antfu/install-pkg/node_modules/is-stream": {
      "version": "2.0.1",
      "resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz",
      "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
      "dev": true,
      "engines": {
        "node": ">=8"
      }
    },
    "node_modules/@antfu/install-pkg/node_modules/mimic-fn": {
      "version": "2.1.0",
      "resolved": "https://registry.npmmirror.com/mimic-fn/-/mimic-fn-2.1.0.tgz",
      "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
      "dev": true,
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/@antfu/install-pkg/node_modules/npm-run-path": {
      "version": "4.0.1",
      "resolved": "https://registry.npmmirror.com/npm-run-path/-/npm-run-path-4.0.1.tgz",
      "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
      "dev": true,
      "dependencies": {
        "path-key": "^3.0.0"
      },
      "engines": {
        "node": ">=8"
      }
    },
    "node_modules/@antfu/install-pkg/node_modules/onetime": {
      "version": "5.1.2",
      "resolved": "https://registry.npmmirror.com/onetime/-/onetime-5.1.2.tgz",
      "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
      "dev": true,
      "dependencies": {
        "mimic-fn": "^2.1.0"
      },
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/@antfu/install-pkg/node_modules/strip-final-newline": {
      "version": "2.0.0",
      "resolved": "https://registry.npmmirror.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
      "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
      "dev": true,
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/@antfu/utils": {
@@ -712,6 +806,35 @@
      "resolved": "https://registry.npmmirror.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz",
      "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
      "dev": true
    },
    "node_modules/@iconify-json/mdi": {
      "version": "1.1.55",
      "resolved": "https://registry.npmmirror.com/@iconify-json/mdi/-/mdi-1.1.55.tgz",
      "integrity": "sha512-ycnFub+EQx+3D/aDCg6iC7sjexOUa5GzxUNIZFFl0Pq7aDxbmhIludoyYnguEO3REyWf9FcOOmvVcQkdtwKHTw==",
      "dev": true,
      "dependencies": {
        "@iconify/types": "*"
      }
    },
    "node_modules/@iconify/types": {
      "version": "2.0.0",
      "resolved": "https://registry.npmmirror.com/@iconify/types/-/types-2.0.0.tgz",
      "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==",
      "dev": true
    },
    "node_modules/@iconify/utils": {
      "version": "2.1.11",
      "resolved": "https://registry.npmmirror.com/@iconify/utils/-/utils-2.1.11.tgz",
      "integrity": "sha512-M/w3PkN8zQYXi8N6qK/KhnYMfEbbb6Sk8RZVn8g+Pmmu5ybw177RpsaGwpziyHeUsu4etrexYSWq3rwnIqzYCg==",
      "dev": true,
      "dependencies": {
        "@antfu/install-pkg": "^0.1.1",
        "@antfu/utils": "^0.7.5",
        "@iconify/types": "^2.0.0",
        "debug": "^4.3.4",
        "kolorist": "^1.8.0",
        "local-pkg": "^0.4.3"
      }
    },
    "node_modules/@jridgewell/sourcemap-codec": {
      "version": "1.4.15",
@@ -1455,6 +1578,21 @@
      "resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz",
      "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg=="
    },
    "node_modules/asynckit": {
      "version": "0.4.0",
      "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
    },
    "node_modules/axios": {
      "version": "1.5.1",
      "resolved": "https://registry.npmmirror.com/axios/-/axios-1.5.1.tgz",
      "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==",
      "dependencies": {
        "follow-redirects": "^1.15.0",
        "form-data": "^4.0.0",
        "proxy-from-env": "^1.1.0"
      }
    },
    "node_modules/balanced-match": {
      "version": "1.0.2",
      "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -1635,6 +1773,17 @@
      "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
      "dev": true
    },
    "node_modules/combined-stream": {
      "version": "1.0.8",
      "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
      "dependencies": {
        "delayed-stream": "~1.0.0"
      },
      "engines": {
        "node": ">= 0.8"
      }
    },
    "node_modules/commander": {
      "version": "11.1.0",
      "resolved": "https://registry.npmmirror.com/commander/-/commander-11.1.0.tgz",
@@ -1756,6 +1905,14 @@
      "dev": true,
      "engines": {
        "node": ">=12"
      }
    },
    "node_modules/delayed-stream": {
      "version": "1.0.0",
      "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
      "engines": {
        "node": ">=0.4.0"
      }
    },
    "node_modules/dir-glob": {
@@ -2290,6 +2447,32 @@
      "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==",
      "dev": true
    },
    "node_modules/follow-redirects": {
      "version": "1.15.3",
      "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.3.tgz",
      "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
      "engines": {
        "node": ">=4.0"
      },
      "peerDependenciesMeta": {
        "debug": {
          "optional": true
        }
      }
    },
    "node_modules/form-data": {
      "version": "4.0.0",
      "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz",
      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
      "dependencies": {
        "asynckit": "^0.4.0",
        "combined-stream": "^1.0.8",
        "mime-types": "^2.1.12"
      },
      "engines": {
        "node": ">= 6"
      }
    },
    "node_modules/fs.realpath": {
      "version": "1.0.0",
      "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -2706,6 +2889,12 @@
        "json-buffer": "3.0.1"
      }
    },
    "node_modules/kolorist": {
      "version": "1.8.0",
      "resolved": "https://registry.npmmirror.com/kolorist/-/kolorist-1.8.0.tgz",
      "integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==",
      "dev": true
    },
    "node_modules/levn": {
      "version": "0.4.1",
      "resolved": "https://registry.npmmirror.com/levn/-/levn-0.4.1.tgz",
@@ -2978,6 +3167,25 @@
      },
      "engines": {
        "node": ">=8.6"
      }
    },
    "node_modules/mime-db": {
      "version": "1.52.0",
      "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
      "engines": {
        "node": ">= 0.6"
      }
    },
    "node_modules/mime-types": {
      "version": "2.1.35",
      "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
      "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
      "dependencies": {
        "mime-db": "1.52.0"
      },
      "engines": {
        "node": ">= 0.6"
      }
    },
    "node_modules/mimic-fn": {
@@ -3457,6 +3665,11 @@
      "engines": {
        "node": ">=6.0.0"
      }
    },
    "node_modules/proxy-from-env": {
      "version": "1.1.0",
      "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
    },
    "node_modules/punycode": {
      "version": "2.3.0",
@@ -4159,6 +4372,58 @@
        "node": ">=16 || 14 >=14.17"
      }
    },
    "node_modules/unplugin-icons": {
      "version": "0.17.1",
      "resolved": "https://registry.npmmirror.com/unplugin-icons/-/unplugin-icons-0.17.1.tgz",
      "integrity": "sha512-KsWejBPCHokYCNDQUzGu6R3E3XDYH/YpewgQwrVBXgpl1iR0RdW1NEGNdjlbuapwVnZXVgA5eiDTfNaQCawSdg==",
      "dev": true,
      "dependencies": {
        "@antfu/install-pkg": "^0.1.1",
        "@antfu/utils": "^0.7.6",
        "@iconify/utils": "^2.1.11",
        "debug": "^4.3.4",
        "kolorist": "^1.8.0",
        "local-pkg": "^0.5.0",
        "unplugin": "^1.5.0"
      },
      "peerDependencies": {
        "@svgr/core": ">=7.0.0",
        "@svgx/core": "^1.0.1",
        "@vue/compiler-sfc": "^3.0.2 || ^2.7.0",
        "vue-template-compiler": "^2.6.12",
        "vue-template-es2015-compiler": "^1.9.0"
      },
      "peerDependenciesMeta": {
        "@svgr/core": {
          "optional": true
        },
        "@svgx/core": {
          "optional": true
        },
        "@vue/compiler-sfc": {
          "optional": true
        },
        "vue-template-compiler": {
          "optional": true
        },
        "vue-template-es2015-compiler": {
          "optional": true
        }
      }
    },
    "node_modules/unplugin-icons/node_modules/local-pkg": {
      "version": "0.5.0",
      "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.5.0.tgz",
      "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==",
      "dev": true,
      "dependencies": {
        "mlly": "^1.4.2",
        "pkg-types": "^1.0.3"
      },
      "engines": {
        "node": ">=14"
      }
    },
    "node_modules/unplugin-vue-components": {
      "version": "0.25.2",
      "resolved": "https://registry.npmmirror.com/unplugin-vue-components/-/unplugin-vue-components-0.25.2.tgz",
@@ -4499,6 +4764,77 @@
      "resolved": "https://registry.npmmirror.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
      "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==",
      "dev": true
    },
    "@antfu/install-pkg": {
      "version": "0.1.1",
      "resolved": "https://registry.npmmirror.com/@antfu/install-pkg/-/install-pkg-0.1.1.tgz",
      "integrity": "sha512-LyB/8+bSfa0DFGC06zpCEfs89/XoWZwws5ygEa5D+Xsm3OfI+aXQ86VgVG7Acyef+rSZ5HE7J8rrxzrQeM3PjQ==",
      "dev": true,
      "requires": {
        "execa": "^5.1.1",
        "find-up": "^5.0.0"
      },
      "dependencies": {
        "execa": {
          "version": "5.1.1",
          "resolved": "https://registry.npmmirror.com/execa/-/execa-5.1.1.tgz",
          "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
          "dev": true,
          "requires": {
            "cross-spawn": "^7.0.3",
            "get-stream": "^6.0.0",
            "human-signals": "^2.1.0",
            "is-stream": "^2.0.0",
            "merge-stream": "^2.0.0",
            "npm-run-path": "^4.0.1",
            "onetime": "^5.1.2",
            "signal-exit": "^3.0.3",
            "strip-final-newline": "^2.0.0"
          }
        },
        "human-signals": {
          "version": "2.1.0",
          "resolved": "https://registry.npmmirror.com/human-signals/-/human-signals-2.1.0.tgz",
          "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
          "dev": true
        },
        "is-stream": {
          "version": "2.0.1",
          "resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz",
          "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
          "dev": true
        },
        "mimic-fn": {
          "version": "2.1.0",
          "resolved": "https://registry.npmmirror.com/mimic-fn/-/mimic-fn-2.1.0.tgz",
          "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
          "dev": true
        },
        "npm-run-path": {
          "version": "4.0.1",
          "resolved": "https://registry.npmmirror.com/npm-run-path/-/npm-run-path-4.0.1.tgz",
          "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
          "dev": true,
          "requires": {
            "path-key": "^3.0.0"
          }
        },
        "onetime": {
          "version": "5.1.2",
          "resolved": "https://registry.npmmirror.com/onetime/-/onetime-5.1.2.tgz",
          "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
          "dev": true,
          "requires": {
            "mimic-fn": "^2.1.0"
          }
        },
        "strip-final-newline": {
          "version": "2.0.0",
          "resolved": "https://registry.npmmirror.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
          "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
          "dev": true
        }
      }
    },
    "@antfu/utils": {
      "version": "0.7.6",
@@ -4901,6 +5237,35 @@
      "resolved": "https://registry.npmmirror.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz",
      "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
      "dev": true
    },
    "@iconify-json/mdi": {
      "version": "1.1.55",
      "resolved": "https://registry.npmmirror.com/@iconify-json/mdi/-/mdi-1.1.55.tgz",
      "integrity": "sha512-ycnFub+EQx+3D/aDCg6iC7sjexOUa5GzxUNIZFFl0Pq7aDxbmhIludoyYnguEO3REyWf9FcOOmvVcQkdtwKHTw==",
      "dev": true,
      "requires": {
        "@iconify/types": "*"
      }
    },
    "@iconify/types": {
      "version": "2.0.0",
      "resolved": "https://registry.npmmirror.com/@iconify/types/-/types-2.0.0.tgz",
      "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==",
      "dev": true
    },
    "@iconify/utils": {
      "version": "2.1.11",
      "resolved": "https://registry.npmmirror.com/@iconify/utils/-/utils-2.1.11.tgz",
      "integrity": "sha512-M/w3PkN8zQYXi8N6qK/KhnYMfEbbb6Sk8RZVn8g+Pmmu5ybw177RpsaGwpziyHeUsu4etrexYSWq3rwnIqzYCg==",
      "dev": true,
      "requires": {
        "@antfu/install-pkg": "^0.1.1",
        "@antfu/utils": "^0.7.5",
        "@iconify/types": "^2.0.0",
        "debug": "^4.3.4",
        "kolorist": "^1.8.0",
        "local-pkg": "^0.4.3"
      }
    },
    "@jridgewell/sourcemap-codec": {
      "version": "1.4.15",
@@ -5476,6 +5841,21 @@
      "resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz",
      "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg=="
    },
    "asynckit": {
      "version": "0.4.0",
      "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
      "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
    },
    "axios": {
      "version": "1.5.1",
      "resolved": "https://registry.npmmirror.com/axios/-/axios-1.5.1.tgz",
      "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==",
      "requires": {
        "follow-redirects": "^1.15.0",
        "form-data": "^4.0.0",
        "proxy-from-env": "^1.1.0"
      }
    },
    "balanced-match": {
      "version": "1.0.2",
      "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -5620,6 +6000,14 @@
      "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
      "dev": true
    },
    "combined-stream": {
      "version": "1.0.8",
      "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
      "requires": {
        "delayed-stream": "~1.0.0"
      }
    },
    "commander": {
      "version": "11.1.0",
      "resolved": "https://registry.npmmirror.com/commander/-/commander-11.1.0.tgz",
@@ -5713,6 +6101,11 @@
      "resolved": "https://registry.npmmirror.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
      "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
      "dev": true
    },
    "delayed-stream": {
      "version": "1.0.0",
      "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
      "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
    },
    "dir-glob": {
      "version": "3.0.1",
@@ -6128,6 +6521,21 @@
      "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==",
      "dev": true
    },
    "follow-redirects": {
      "version": "1.15.3",
      "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.3.tgz",
      "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q=="
    },
    "form-data": {
      "version": "4.0.0",
      "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz",
      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
      "requires": {
        "asynckit": "^0.4.0",
        "combined-stream": "^1.0.8",
        "mime-types": "^2.1.12"
      }
    },
    "fs.realpath": {
      "version": "1.0.0",
      "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -6446,6 +6854,12 @@
        "json-buffer": "3.0.1"
      }
    },
    "kolorist": {
      "version": "1.8.0",
      "resolved": "https://registry.npmmirror.com/kolorist/-/kolorist-1.8.0.tgz",
      "integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==",
      "dev": true
    },
    "levn": {
      "version": "0.4.1",
      "resolved": "https://registry.npmmirror.com/levn/-/levn-0.4.1.tgz",
@@ -6655,6 +7069,19 @@
      "requires": {
        "braces": "^3.0.2",
        "picomatch": "^2.3.1"
      }
    },
    "mime-db": {
      "version": "1.52.0",
      "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
    },
    "mime-types": {
      "version": "2.1.35",
      "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
      "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
      "requires": {
        "mime-db": "1.52.0"
      }
    },
    "mimic-fn": {
@@ -7010,6 +7437,11 @@
      "requires": {
        "fast-diff": "^1.1.2"
      }
    },
    "proxy-from-env": {
      "version": "1.1.0",
      "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
    },
    "punycode": {
      "version": "2.3.0",
@@ -7555,6 +7987,33 @@
        }
      }
    },
    "unplugin-icons": {
      "version": "0.17.1",
      "resolved": "https://registry.npmmirror.com/unplugin-icons/-/unplugin-icons-0.17.1.tgz",
      "integrity": "sha512-KsWejBPCHokYCNDQUzGu6R3E3XDYH/YpewgQwrVBXgpl1iR0RdW1NEGNdjlbuapwVnZXVgA5eiDTfNaQCawSdg==",
      "dev": true,
      "requires": {
        "@antfu/install-pkg": "^0.1.1",
        "@antfu/utils": "^0.7.6",
        "@iconify/utils": "^2.1.11",
        "debug": "^4.3.4",
        "kolorist": "^1.8.0",
        "local-pkg": "^0.5.0",
        "unplugin": "^1.5.0"
      },
      "dependencies": {
        "local-pkg": {
          "version": "0.5.0",
          "resolved": "https://registry.npmmirror.com/local-pkg/-/local-pkg-0.5.0.tgz",
          "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==",
          "dev": true,
          "requires": {
            "mlly": "^1.4.2",
            "pkg-types": "^1.0.3"
          }
        }
      }
    },
    "unplugin-vue-components": {
      "version": "0.25.2",
      "resolved": "https://registry.npmmirror.com/unplugin-vue-components/-/unplugin-vue-components-0.25.2.tgz",
package.json
@@ -13,7 +13,9 @@
    "prepare": "husky install"
  },
  "dependencies": {
    "@element-plus/icons-vue": "^2.1.0",
    "@vueuse/core": "^10.5.0",
    "axios": "^1.5.1",
    "element-plus": "^2.4.1",
    "lodash-es": "^4.17.21",
    "pinia": "^2.1.7",
@@ -21,6 +23,7 @@
    "vue-router": "^4.2.5"
  },
  "devDependencies": {
    "@iconify-json/mdi": "^1.1.55",
    "@rushstack/eslint-patch": "^1.3.3",
    "@tsconfig/node18": "^18.2.2",
    "@types/node": "^18.18.6",
@@ -37,6 +40,7 @@
    "sass": "^1.69.4",
    "typescript": "~5.2.0",
    "unplugin-auto-import": "^0.16.6",
    "unplugin-icons": "^0.17.1",
    "unplugin-vue-components": "^0.25.2",
    "vite": "^4.4.11",
    "vue-tsc": "^1.8.19"
src/App.vue
@@ -1,49 +1,24 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
</script>
<template>
  <header>
    <img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
    <div class="wrapper">
      <HelloWorld msg="You did it!" />
      <nav>
        <RouterLink to="/">Home</RouterLink>
        <RouterLink to="/about">About</RouterLink>
      </nav>
    </div>
  </header>
  <nav>
    <RouterLink to="/">Home</RouterLink>
    <RouterLink to="/about">About</RouterLink>
  </nav>
  <RouterView />
</template>
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
</script>
<style scoped>
header {
  line-height: 1.5;
  max-height: 100vh;
}
.logo {
  display: block;
  margin: 0 auto 2rem;
}
nav {
  width: 100%;
  font-size: 12px;
  font-size: 24px;
  text-align: center;
  margin-top: 2rem;
}
nav a.router-link-exact-active {
  color: var(--color-text);
}
nav a.router-link-exact-active:hover {
  background-color: transparent;
  color: var(--el-color-primary);
}
nav a {
@@ -54,32 +29,5 @@
nav a:first-of-type {
  border: 0;
}
@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }
  .logo {
    margin: 0 2rem 0 0;
  }
  header .wrapper {
    display: flex;
    place-items: flex-start;
    flex-wrap: wrap;
  }
  nav {
    text-align: left;
    margin-left: -1rem;
    font-size: 1rem;
    padding: 1rem 0;
    margin-top: 1rem;
  }
}
</style>
src/api/index.ts
New file
@@ -0,0 +1 @@
export {}
src/assets/images/.gitkeep
src/assets/logo.svg
File was deleted
src/assets/main.css
File was deleted
src/assets/styles/base.css
src/assets/styles/main.css
New file
@@ -0,0 +1,9 @@
@import './base.css';
#app {
  max-width: 1280px;
  margin: 0 auto;
  font-weight: normal;
}
src/auto-imports.d.ts
New file
@@ -0,0 +1,77 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
  const EffectScope: (typeof import('vue'))['EffectScope']
  const computed: (typeof import('vue'))['computed']
  const createApp: (typeof import('vue'))['createApp']
  const customRef: (typeof import('vue'))['customRef']
  const defineAsyncComponent: (typeof import('vue'))['defineAsyncComponent']
  const defineComponent: (typeof import('vue'))['defineComponent']
  const effectScope: (typeof import('vue'))['effectScope']
  const getCurrentInstance: (typeof import('vue'))['getCurrentInstance']
  const getCurrentScope: (typeof import('vue'))['getCurrentScope']
  const h: (typeof import('vue'))['h']
  const inject: (typeof import('vue'))['inject']
  const isProxy: (typeof import('vue'))['isProxy']
  const isReactive: (typeof import('vue'))['isReactive']
  const isReadonly: (typeof import('vue'))['isReadonly']
  const isRef: (typeof import('vue'))['isRef']
  const markRaw: (typeof import('vue'))['markRaw']
  const nextTick: (typeof import('vue'))['nextTick']
  const onActivated: (typeof import('vue'))['onActivated']
  const onBeforeMount: (typeof import('vue'))['onBeforeMount']
  const onBeforeUnmount: (typeof import('vue'))['onBeforeUnmount']
  const onBeforeUpdate: (typeof import('vue'))['onBeforeUpdate']
  const onDeactivated: (typeof import('vue'))['onDeactivated']
  const onErrorCaptured: (typeof import('vue'))['onErrorCaptured']
  const onMounted: (typeof import('vue'))['onMounted']
  const onRenderTracked: (typeof import('vue'))['onRenderTracked']
  const onRenderTriggered: (typeof import('vue'))['onRenderTriggered']
  const onScopeDispose: (typeof import('vue'))['onScopeDispose']
  const onServerPrefetch: (typeof import('vue'))['onServerPrefetch']
  const onUnmounted: (typeof import('vue'))['onUnmounted']
  const onUpdated: (typeof import('vue'))['onUpdated']
  const provide: (typeof import('vue'))['provide']
  const reactive: (typeof import('vue'))['reactive']
  const readonly: (typeof import('vue'))['readonly']
  const ref: (typeof import('vue'))['ref']
  const resolveComponent: (typeof import('vue'))['resolveComponent']
  const shallowReactive: (typeof import('vue'))['shallowReactive']
  const shallowReadonly: (typeof import('vue'))['shallowReadonly']
  const shallowRef: (typeof import('vue'))['shallowRef']
  const toRaw: (typeof import('vue'))['toRaw']
  const toRef: (typeof import('vue'))['toRef']
  const toRefs: (typeof import('vue'))['toRefs']
  const toValue: (typeof import('vue'))['toValue']
  const triggerRef: (typeof import('vue'))['triggerRef']
  const unref: (typeof import('vue'))['unref']
  const useAttrs: (typeof import('vue'))['useAttrs']
  const useCssModule: (typeof import('vue'))['useCssModule']
  const useCssVars: (typeof import('vue'))['useCssVars']
  const useSlots: (typeof import('vue'))['useSlots']
  const watch: (typeof import('vue'))['watch']
  const watchEffect: (typeof import('vue'))['watchEffect']
  const watchPostEffect: (typeof import('vue'))['watchPostEffect']
  const watchSyncEffect: (typeof import('vue'))['watchSyncEffect']
}
// for type re-export
declare global {
  // @ts-ignore
  export type {
    Component,
    ComponentPublicInstance,
    ComputedRef,
    ExtractDefaultPropTypes,
    ExtractPropTypes,
    ExtractPublicPropTypes,
    InjectionKey,
    PropType,
    Ref,
    VNode,
    WritableComputedRef
  } from 'vue'
}
src/common/composable/index.ts
New file
@@ -0,0 +1,3 @@
// 本文件放置通用 composable (组合式函数), 注意与 utils 区分
export {}
src/common/constants/index.ts
New file
@@ -0,0 +1,3 @@
// 本文件放置公共常量定义/公共配置等
export {}
src/common/utils/index.ts
New file
@@ -0,0 +1,12 @@
// 本文件放置项目通用工具函数, 注意要与 composable 区分
import request from './request'
function getToken() {
  return localStorage.getItem('token')
}
function setToken(token: string) {
  localStorage.setItem('token', token)
}
export { request, getToken, setToken }
src/common/utils/request.ts
New file
@@ -0,0 +1,62 @@
import axios from 'axios'
import { ElMessage } from 'element-plus'
import { getToken } from '@/common/utils/index'
const Axios = axios.create({
  responseType: 'json',
  withCredentials: true // 允许携带 cookie
})
/**
 * 请求拦截器
 */
Axios.interceptors.request.use(
  (config) => {
    // 若是有做鉴权token , 就给头部带上token
    const token = getToken()
    if (token) {
      config.headers.Authorization = 'Bearer ' + token
    }
    return config
  },
  (error) => {
    return Promise.reject(error)
  }
)
/**
 * 响应拦截器
 */
Axios.interceptors.response.use(
  (res) => {
    if (res.data.code == 200) {
      return res.data ?? {}
    } else {
      ElMessage({
        message: res.data.msg,
        type: 'error',
        duration: 3 * 1000
      })
      return res.data ?? {}
    }
  },
  (error) => {
    let { message } = error
    if (message === 'Network Error') {
      message = '后端接口连接异常'
    } else if (message.includes('timeout')) {
      message = '系统接口请求超时'
    } else if (message.includes('Request failed with status code')) {
      message = '系统接口' + message.substr(message.length - 3) + '异常'
    }
    ElMessage({
      message: message,
      type: 'error',
      duration: 3 * 1000
    })
    return Promise.reject(error)
  }
)
export default Axios
src/components.d.ts
New file
@@ -0,0 +1,16 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
  export interface GlobalComponents {
    ElButton: (typeof import('element-plus/es'))['ElButton']
    ElIcon: (typeof import('element-plus/es'))['ElIcon']
    HelloWorld: (typeof import('./components/HelloWorld.vue'))['default']
    RouterLink: (typeof import('vue-router'))['RouterLink']
    RouterView: (typeof import('vue-router'))['RouterView']
  }
}
src/components/HelloWorld.vue
@@ -29,11 +29,4 @@
.greetings h3 {
  text-align: center;
}
@media (min-width: 1024px) {
  .greetings h1,
  .greetings h3 {
    text-align: left;
  }
}
</style>
src/main.ts
@@ -1,4 +1,4 @@
import './assets/main.css'
import './assets/styles/main.css'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
src/views/AboutView.vue
@@ -1,22 +1,9 @@
<template>
  <div class="about">
    count: {{ counter.count }}
    <el-button size="small" @click="counter.increment">按钮</el-button>
  <div class="about-view">
    <h1>About View</h1>
  </div>
</template>
<script setup lang="ts">
import { useCounterStore } from '@/stores/counter'
<script setup lang="ts"></script>
let counter = useCounterStore()
</script>
<style lang="scss">
@media (min-width: 1024px) {
  .about {
    min-height: 100vh;
    display: flex;
    align-items: center;
  }
}
</style>
<style lang="scss"></style>
src/views/HomeView.vue
@@ -1,3 +1,51 @@
<script setup lang="ts"></script>
<template>
  <div class="home-view">
    <h1>Home View</h1>
    <h2>pinia 示例</h2>
    <section>
      <span> count: {{ counter.count }} </span>
      <el-button type="primary" @click="counter.increment">加一</el-button>
    </section>
    <h2>element plus 组件 icon 示例</h2>
    <section>
      <el-button type="primary">
        <el-icon style="vertical-align: middle">
          <Search />
        </el-icon>
        <span style="vertical-align: middle"> Search </span>
<template>home</template>
        <el-icon class="is-loading">
          <Loading />
        </el-icon>
      </el-button>
    </section>
    <h2>Iconify 图标示例, 支持自动下载自动导入</h2>
    <section>
      <p><a href="https://icon-sets.iconify.design/">iconify</a></p>
      <p>
        iconify 有许多图标集合,所以配置了自动下载和自动引入,
        但是下载所有的图标集合需要约120兆,所以建议事先选定好用哪个图标集, 别乱加图标不然要下载好多
      </p>
      <p>使用方法: <a href="https://github.com/unplugin/unplugin-icons#usage">github.com/unplugin/unplugin-icons</a></p>
      <div>
        <el-icon size="40" color="red">
          <IconAlert />
        </el-icon>
      </div>
    </section>
  </div>
</template>
<script setup lang="ts">
import { useCounterStore } from '@/stores/counter'
import { Loading, Search } from '@element-plus/icons-vue'
import IconAlert from '~icons/mdi/alert'
const counter = useCounterStore()
</script>
<style lang="scss" scoped>
section {
  margin: 10px 0 40px 0;
}
</style>
tsconfig.app.json
@@ -1,6 +1,6 @@
{
  "extends": "@vue/tsconfig/tsconfig.dom.json",
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "global.d.ts"],
  "exclude": ["src/**/__tests__/*"],
  "compilerOptions": {
    "composite": true,
tsconfig.json
@@ -7,5 +7,9 @@
    {
      "path": "./tsconfig.app.json"
    }
  ]
  ],
  "compilerOptions": {
    // 修复 Cannot find module '~icons/xxx/xxx' or its corresponding type declarations.ts(2307)
    "types": ["unplugin-icons/types/vue"]
  }
}
tsconfig.node.json
@@ -1,12 +1,6 @@
{
  "extends": "@tsconfig/node18/tsconfig.json",
  "include": [
    "vite.config.*",
    "vitest.config.*",
    "cypress.config.*",
    "nightwatch.conf.*",
    "playwright.config.*"
  ],
  "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "nightwatch.conf.*", "playwright.config.*"],
  "compilerOptions": {
    "composite": true,
    "module": "ESNext",
vite.config.ts
@@ -1,25 +1,51 @@
import { fileURLToPath, URL } from 'node:url'
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import IconsResolver from 'unplugin-icons/resolver'
import Icons from 'unplugin-icons/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
const pathSrc = path.resolve(__dirname, 'src')
// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': pathSrc
    }
  },
  plugins: [
    vue(),
    // element plus 自动导入
    AutoImport({
      resolvers: [ElementPlusResolver()]
      // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
      imports: ['vue'],
      // 自动导入 Element Plus 相关函数,如:ElMessage, ElMessageBox... (带样式)
      resolvers: [
        ElementPlusResolver(),
        // 自动导入图标组件
        IconsResolver({
          prefix: 'Icon'
        })
      ],
      dts: path.resolve(pathSrc, 'auto-imports.d.ts')
    }),
    Components({
      resolvers: [ElementPlusResolver()]
      resolvers: [
        // 自动注册图标组件
        IconsResolver({
          enabledCollections: ['ep']
        }),
        // 自动导入 Element Plus 组件
        ElementPlusResolver()
      ],
      dts: path.resolve(pathSrc, 'components.d.ts')
    }),
    Icons({
      autoInstall: true
    })
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
  ]
})