diff --git a/.browserslistrc b/.browserslistrc
deleted file mode 100644
index d6471a38cc6e6e02345c1edce109312520a77d0d..0000000000000000000000000000000000000000
--- a/.browserslistrc
+++ /dev/null
@@ -1,2 +0,0 @@
-> 1%
-last 2 versions
diff --git a/.dockerignore b/.dockerignore
index 27ef30a21ba6334c99ec769172ba13d6eea08bb4..d451ff16c1010b8dc4285ef4d338028792a0ecd3 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,21 +1,5 @@
-.DS_Store
node_modules
-/dist
-
-# local env files
-.env.local
-.env.*.local
-
-# Log files
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-yarn.lock
-
-# Editor directories and files
-.idea
-*.suo
-*.ntvs*
-*.njsproj
-*.sln
-*.sw?
+.DS_Store
+dist
+dist-ssr
+*.local
diff --git a/.eslintignore b/.eslintignore
index 53841920a578c7cc7b470b025c05befc60740ff4..3c018eed27ff620c58e5e98b821069f3f7d7e6ee 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,6 +1 @@
-/public/
-/dist/
-/node_modules/
-/src/icons/svg/
-/mock/
-vue.config.js
+vite.config.ts
\ No newline at end of file
diff --git a/.eslintrc.js b/.eslintrc.js
index 39bd4135eace39b8ff1be1fccad7aba96999f82b..df549f77bbbd443a04152de7c6bc1007a69504ec 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,14 +1,76 @@
module.exports = {
root: true,
env: {
- node: true
- },
- extends: ["plugin:vue/essential", "@vue/prettier"],
- rules: {
- "no-console": "off",
- "comma-dangle": [2, "never"]
+ browser: true,
+ node: true,
+ es6: true
},
+ parser: "vue-eslint-parser",
parserOptions: {
- parser: "@typescript-eslint/parser"
+ parser: "@typescript-eslint/parser",
+ ecmaVersion: 2020,
+ sourceType: "module",
+ jsxPragma: "React",
+ ecmaFeatures: {
+ jsx: true,
+ tsx: true
+ }
+ },
+ extends: [
+ "plugin:vue/vue3-recommended",
+ "plugin:@typescript-eslint/recommended",
+ "prettier",
+ "plugin:prettier/recommended"
+ ],
+ rules: {
+ "@typescript-eslint/ban-ts-ignore": "off",
+ "@typescript-eslint/explicit-function-return-type": "off",
+ "@typescript-eslint/no-explicit-any": "off",
+ "@typescript-eslint/no-var-requires": "off",
+ "@typescript-eslint/no-empty-function": "off",
+ "vue/component-name-in-template-casing": ["error", "kebab-case"],
+ "vue/component-definition-name-casing": ["error", "kebab-case"],
+ "no-use-before-define": "off",
+ "@typescript-eslint/no-use-before-define": "off",
+ "@typescript-eslint/ban-ts-comment": "off",
+ "@typescript-eslint/ban-types": "off",
+ "@typescript-eslint/no-non-null-assertion": "off",
+ "@typescript-eslint/explicit-module-boundary-types": "off",
+ "@typescript-eslint/no-unused-vars": [
+ "error",
+ {
+ argsIgnorePattern: "^h$",
+ varsIgnorePattern: "^h$"
+ }
+ ],
+ "no-unused-vars": [
+ "error",
+ {
+ argsIgnorePattern: "^h$",
+ varsIgnorePattern: "^h$"
+ }
+ ],
+ "space-before-function-paren": "off",
+ "vue/attributes-order": "off",
+ "vue/one-component-per-file": "off",
+ "vue/html-closing-bracket-newline": "off",
+ "vue/max-attributes-per-line": "off",
+ "vue/multiline-html-element-content-newline": "off",
+ "vue/singleline-html-element-content-newline": "off",
+ "vue/attribute-hyphenation": "off",
+ // "vue/html-self-closing": "off",
+ "vue/require-default-prop": "off",
+ "vue/html-self-closing": [
+ "error",
+ {
+ html: {
+ void: "always",
+ normal: "never",
+ component: "always"
+ },
+ svg: "always",
+ math: "always"
+ }
+ ]
}
};
diff --git a/.gitignore b/.gitignore
index 27ef30a21ba6334c99ec769172ba13d6eea08bb4..d451ff16c1010b8dc4285ef4d338028792a0ecd3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,5 @@
-.DS_Store
node_modules
-/dist
-
-# local env files
-.env.local
-.env.*.local
-
-# Log files
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-yarn.lock
-
-# Editor directories and files
-.idea
-*.suo
-*.ntvs*
-*.njsproj
-*.sln
-*.sw?
+.DS_Store
+dist
+dist-ssr
+*.local
diff --git a/.vscode/crud.code-snippets b/.vscode/crud.code-snippets
index a86c77664a16226f20414459a89ec99a0036fc5b..9bd0526ecf06ee2db53f34ceacc04e9b53e6c756 100644
--- a/.vscode/crud.code-snippets
+++ b/.vscode/crud.code-snippets
@@ -1,9 +1,9 @@
{
"cl-crud": {
- "prefix": "cl-crud",
+ "prefix": "cl-crud-ts",
"body": [
"",
- " ",
+ " ",
" ",
" ",
" ",
@@ -18,7 +18,7 @@
"",
" ",
" ",
- " ",
+ " ",
" ",
"",
" ",
@@ -28,31 +28,47 @@
" ",
"",
" ",
- " ",
+ " ",
" ",
"",
"",
- "",
""
],
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000000000000000000000000000000000000..48fc344b19849e0d784d9b7984c50f1c6e0fd09a
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "editor.cursorSmoothCaretAnimation": true
+}
diff --git a/Dockerfile b/Dockerfile
index dad46df23ab15206d94d8e5e4e310185119d054f..dc4247a935f520d1d32b8d446bee09229a3896d1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,9 @@
FROM node:lts-alpine
WORKDIR /build
-RUN npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
-RUN npm set registry https://registry.npm.taobao.org
+# 设置Node-Sass的镜像地址
+RUN npm config set sass_binary_site https://repo.huaweicloud.com/node-sass
+# 设置npm镜像
+RUN npm config set registry https://repo.huaweicloud.com/repository/npm/
COPY package.json /build/package.json
RUN npm install
COPY ./ /build
diff --git a/README.md b/README.md
index 76604df9d2ef3686bbd84c3218caa2ebff34a01c..7bb0ea009944ea286f799558fb82f8618bfaadb9 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+# cool-admin [vue3 - ts - vite]
+
@@ -10,14 +12,23 @@
+## 地址
+
+- [⚡️ vue2.x + element-ui](https://github.com/cool-team-official/cool-admin-vue)
+
+- [⚡️ vue3.x + element-plus + ts + webpack](https://github.com/cool-team-official/cool-admin-vue/tree/vue3-ts-webpack)
+
+- [📌 vue3.x + element-plus + ts + vite](https://github.com/cool-team-official/cool-admin-vue/tree/vue3-ts-vite)
+
+- [🌐 码云仓库地址](https://gitee.com/cool-team-official/cool-admin-vue)
+
## 演示
[https://show.cool-admin.com](https://show.cool-admin.com)
-- 账户:admin
-- 密码:123456
+账户:admin,密码:123456
-
+
## 项目后端
@@ -35,10 +46,6 @@
[https://bbs.cool-js.com/](https://bbs.cool-js.com/)
-## 使用条件
-
-请确保您的操作系统上安装了 Node.js(> = 8.9.0)、@vue/cli (> 3.0.0)。
-
## 安装项目依赖
推荐使用 `yarn`:
@@ -58,233 +65,5 @@ yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
安装过程完成后,运行以下命令启动服务。您可以在浏览器中预览网站 [http://localhost:9000](http://localhost:9000)
```shell
-yarn serve
-```
-
-## 极速 CRUD
-
-1. `vscode` 编辑器下输入关键字 `cl-crud`,会生成对应的模板代码:
-
-```html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-```
-
-2. 编辑数据表格 `cl-table`:
-
-```js
-{
- table: {
- // 参数与 el-table-column 一致,并支持许多骚操作
- columns: [
- // 多选列
- {
- type: "selection",
- width: 60
- },
- // 自定义列
- {
- label: "昵称",
- prop: "name"
- },
- {
- label: "账户",
- prop: "price",
- sortable: "custom" // 是否添加排序
- },
- {
- label: "状态",
- prop: "status",
- // 字典匹配,使用 el-tag 展示
- dict: [
- {
- label: "启用",
- value: 1,
- type: "primary"
- },
- {
- label: "禁用",
- value: 0,
- type: "danger"
- }
- ]
- },
- {
- label: "创建时间",
- prop: "createTime"
- },
- // 操作按钮列,默认包含:编辑、删除
- {
- type: "op"
- }
- ];
- }
-}
+yarn dev
```
-
-3. 编辑新增、编辑表单 `cl-upsert`:
-
-```js
-{
- upsert: {
- items: [
- {
- label: "昵称",
- prop: "name",
- // 参数与 el-form-item 一致
- props: {},
- value: "神仙都没用", // 昵称默认值
- // 渲染参数,支持 slot, 组件实例,jsx
- component: {
- name: "el-input", // 可以是任意已注册的组件名
- props: {}, // 组件的参数
- on: {} // 组件的回调事件
- },
- // 验证规则,与 el-form 一致
- rules: {
- required: true,
- message: "昵称不呢为空"
- }
- },
- {
- label: "存款",
- prop: "price",
- component: {
- name: "el-input-number",
- props: {
- min: 0,
- max: 10000
- }
- }
- },
- {
- label: "状态",
- prop: "status",
- value: 1,
- component: {
- name: "el-radio-group",
- options: [
- {
- label: "启用",
- value: 1
- },
- {
- label: "禁用",
- value: 0
- }
- ]
- }
- }
- ];
- }
-}
-```
-
-4. 绑定 `service`。在 `src/service/` 下新建文件 `test.js`,并编辑:
-
-```js
-// src/service/test.js
-import { BaseService, Service, Permission } from "cl-admin";
-
-// 请求接口的路径
-@Service("test")
-class Test extends BaseService {
- // 继承 BaseService 后,拥有 page, list, add, delete, update, info 6个基本接口
-
- // 自定义其他接口
- @Permission("product") // 权限装饰器,可选
- product(id) {
- // this.request() 参数与 axios 一致
- return this.request({
- url: "/product",
- method: "POST",
- data: {
- id
- }
- });
- }
-}
-
-export default Test;
-```
-
-在 `src/service/` 下的文件,框架会自动根据 `目录结构` 和 `文件名称` 格式化成对应的 `$service` 对象。你现在可以这么使用它:
-
-```js
-this.$service.test.page({ page: 1 });
-this.$service.test.product(1);
-```
-
-`service` 编写好后,我们把它绑定在 `crud` 上:
-
-```js
-export default {
- methods: {
- onLoad({ ctx, app }) {
- // 绑定 service,这边指定到 test 即可
- ctx.service(this.$service.test).done();
-
- // 发起 page 请求
- app.refresh({
- // 请求默认参数
- });
- }
- }
-};
-```
-
-5. 效果预览
-
-
diff --git a/babel.config.js b/babel.config.js
deleted file mode 100644
index 32df09b97bb534a87a52d6a7aa38d4dfcd2704c5..0000000000000000000000000000000000000000
--- a/babel.config.js
+++ /dev/null
@@ -1,13 +0,0 @@
-module.exports = {
- presets: ["@vue/app"],
- plugins: [
- ["jsx-v-model"],
- [
- "component",
- {
- libraryName: "element-ui",
- styleLibraryName: "theme-chalk"
- }
- ]
- ]
-};
diff --git a/public/index.html b/index.html
similarity index 74%
rename from public/index.html
rename to index.html
index 340e6c78ebd4649153cdf590e3e14251c96dba47..089bde0dfe921b70073a92afdbe0ec0d6679004b 100644
--- a/public/index.html
+++ b/index.html
@@ -9,11 +9,8 @@
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0"
/>
-
COOL-ADMIN
- <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
-
- <% } %>
+
-
-
- <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
-
- <% } %>
+