= {
+ [P in keyof T]: T extends Record ? P : never;
+}[keyof T];
+
+/** `OptionalKeys`是用来获取所有可选字段,其中这些可选字段组合成一个联合类型 */
+type OptionalKeys = {
+ [P in keyof T]: {} extends Pick ? P : never;
+}[keyof T];
+
+/** `GetRequired`是用来获取一个类型中,所有必填键及其类型所组成的一个新类型的 */
+type GetRequired = {
+ [P in RequiredKeys]-?: T[P];
+};
+
+/** `GetOptional`是用来获取一个类型中,所有可选键及其类型所组成的一个新类型的 */
+type GetOptional = {
+ [P in OptionalKeys]?: T[P];
+};
+
+/** type result1 = Includes<[1, 2, 3, 4], '4'> 结果: false; type result2 = Includes<[1, 2, 3, 4], 4> 结果: true */
+type Includes = K extends T[number] ? true : false;
+
+/** eg:type result = MyConcat<[1, 2], [3, 4]> 结果:[1, 2, 3, 4]*/
+type MyConcat = [...T, ...U];
+/** eg: type result1 = MyPush<[1, 2, 3], 4> 结果:[1, 2, 3, 4] */
+type MyPush = [...T, K];
+/** eg: type result3 = MyPop<[1, 2, 3]> 结果:[1, 2] */
+type MyPop = T extends [...infer L, infer R] ? L : never; // eslint-disable-line
diff --git a/vite.config.ts b/vite.config.ts
index a3d6357..45e6c52 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -55,9 +55,17 @@ export default ({ mode }: ConfigEnv): UserConfig => {
targets: ['defaults', 'not IE 11'],
}),
AutoImport({
- resolvers: [ElementPlusResolver(), VantResolver()],
+ include: [
+ /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
+ /\.vue$/,
+ /\.vue\?vue/, // .vue
+ /\.md$/, // .md
+ ],
+ dts: true,
+ imports: ['vue', 'vue-router'],
}),
Components({
+ dts: true,
resolvers: [ElementPlusResolver(), VantResolver()],
}),
],
@@ -99,7 +107,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
},
},
optimizeDeps: {
- include: ['@vueuse/core', 'element-plus', 'vant', 'lodash', 'vuedraggable'],
+ include: ['@vueuse/core', 'element-plus', 'vant', 'lodash-es', 'vuedraggable'],
},
server: {
host: '0.0.0.0',
@@ -110,7 +118,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
// 设置代理,根据项目实际情况配置
proxy: {
'/api': {
- target: 'http://29135jo738.zicp.vip/api/v1',
+ target: 'https://nest-api.buqiyuan.site/api/admin/',
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace('/api/', '/'),