From f8690a0b730c0adcc9fac6d52f147c623b190a20 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Sun, 15 Dec 2024 23:29:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8?= =?UTF-8?q?`this`=E8=AF=AD=E6=B3=95=E6=97=B6=E6=97=A0=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BB=A3=E7=A0=81=E6=8F=90=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=B9=B6=E6=9B=B4=E6=96=B0`pinia`=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ReTreeLine/index.ts | 4 ++-- src/store/modules/app.ts | 3 +-- src/store/modules/epTheme.ts | 3 +-- src/store/modules/multiTags.ts | 7 +++---- src/store/modules/permission.ts | 5 ++--- src/store/modules/settings.ts | 3 +-- src/store/modules/user.ts | 3 +-- src/utils/print.ts | 8 ++++++++ tsconfig.json | 3 ++- types/global-components.d.ts | 1 + 10 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/components/ReTreeLine/index.ts b/src/components/ReTreeLine/index.ts index 80a396538f..c486c8d7ad 100644 --- a/src/components/ReTreeLine/index.ts +++ b/src/components/ReTreeLine/index.ts @@ -90,9 +90,9 @@ export default defineComponent({ ]; // 取得每一层的当前节点是不是在当前层级列表的最后一个 const lastnodeArr = []; - let currentNode = this.node; + let currentNode: any = this.node; while (currentNode) { - let parentNode = currentNode.parent; + let parentNode: any = currentNode.parent; // 兼容element-plus的 el-tree-v2 (Virtualized Tree 虚拟树) if (currentNode.level === 1 && !currentNode.parent) { // el-tree-v2的第一层node是没有parent的,必需 treeData 创建一个parent diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index ea928304c6..c9284dac0f 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -8,8 +8,7 @@ import { responsiveStorageNameSpace } from "../utils"; -export const useAppStore = defineStore({ - id: "pure-app", +export const useAppStore = defineStore("pure-app", { state: (): appType => ({ sidebar: { opened: diff --git a/src/store/modules/epTheme.ts b/src/store/modules/epTheme.ts index fa73effd43..e6f62d203f 100644 --- a/src/store/modules/epTheme.ts +++ b/src/store/modules/epTheme.ts @@ -6,8 +6,7 @@ import { responsiveStorageNameSpace } from "../utils"; -export const useEpThemeStore = defineStore({ - id: "pure-epTheme", +export const useEpThemeStore = defineStore("pure-epTheme", { state: () => ({ epThemeColor: storageLocal().getItem( diff --git a/src/store/modules/multiTags.ts b/src/store/modules/multiTags.ts index fee223402b..5d1b669c82 100644 --- a/src/store/modules/multiTags.ts +++ b/src/store/modules/multiTags.ts @@ -14,8 +14,7 @@ import { } from "../utils"; import { usePermissionStoreHook } from "./permission"; -export const useMultiTagsStore = defineStore({ - id: "pure-multiTags", +export const useMultiTagsStore = defineStore("pure-multiTags", { state: () => ({ // 存储标签页信息(路由信息) multiTags: storageLocal().getItem( @@ -24,12 +23,12 @@ export const useMultiTagsStore = defineStore({ ? storageLocal().getItem( `${responsiveStorageNameSpace()}tags` ) - : [ + : ([ ...routerArrays, ...usePermissionStoreHook().flatteningRoutes.filter( v => v?.meta?.fixedTag ) - ], + ] as any), multiTagsCache: storageLocal().getItem( `${responsiveStorageNameSpace()}configure` )?.multiTagsCache diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 2ddca781a0..97bc7cd9b7 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -12,8 +12,7 @@ import { } from "../utils"; import { useMultiTagsStoreHook } from "./multiTags"; -export const usePermissionStore = defineStore({ - id: "pure-permission", +export const usePermissionStore = defineStore("pure-permission", { state: () => ({ // 静态路由生成的菜单 constantMenus, @@ -31,7 +30,7 @@ export const usePermissionStore = defineStore({ filterTree(ascending(this.constantMenus.concat(routes))) ); this.flatteningRoutes = formatFlatteningRoutes( - this.constantMenus.concat(routes) + this.constantMenus.concat(routes) as any ); }, cacheOperate({ mode, name }: cacheType) { diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index 7f810f7f15..05c9807180 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -1,8 +1,7 @@ import { defineStore } from "pinia"; import { type setType, store, getConfig } from "../utils"; -export const useSettingStore = defineStore({ - id: "pure-setting", +export const useSettingStore = defineStore("pure-setting", { state: (): setType => ({ title: getConfig().Title, fixedHeader: getConfig().FixedHeader, diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index fac9f929cc..0429847f73 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -16,8 +16,7 @@ import { import { useMultiTagsStoreHook } from "./multiTags"; import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth"; -export const useUserStore = defineStore({ - id: "pure-user", +export const useUserStore = defineStore("pure-user", { state: (): userType => ({ // 头像 avatar: storageLocal().getItem>(userKey)?.avatar ?? "", diff --git a/src/utils/print.ts b/src/utils/print.ts index 0d33bb677a..5f6db1805e 100644 --- a/src/utils/print.ts +++ b/src/utils/print.ts @@ -9,6 +9,7 @@ const Print = function (dom, options?: object): PrintFunction { options = options || {}; // @ts-expect-error if (!(this instanceof Print)) return new Print(dom, options); + // @ts-expect-error this.conf = { styleStr: "", // Elements that need to dynamically get and set the height @@ -18,19 +19,26 @@ const Print = function (dom, options?: object): PrintFunction { // Callback after printing printDoneCallBack: null }; + // @ts-expect-error for (const key in this.conf) { if (key && options.hasOwnProperty(key)) { + // @ts-expect-error this.conf[key] = options[key]; } } if (typeof dom === "string") { + // @ts-expect-error this.dom = document.querySelector(dom); } else { + // @ts-expect-error this.dom = this.isDOM(dom) ? dom : dom.$el; } + // @ts-expect-error if (this.conf.setDomHeightArr && this.conf.setDomHeightArr.length) { + // @ts-expect-error this.setDomHeight(this.conf.setDomHeightArr); } + // @ts-expect-error this.init(); }; diff --git a/tsconfig.json b/tsconfig.json index 5dd960a4e7..fdbd4a6689 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,10 +4,11 @@ "module": "ESNext", "moduleResolution": "bundler", "strict": false, + "strictFunctionTypes": false, + "noImplicitThis": true, "jsx": "preserve", "importHelpers": true, "experimentalDecorators": true, - "strictFunctionTypes": false, "skipLibCheck": true, "esModuleInterop": true, "isolatedModules": true, diff --git a/types/global-components.d.ts b/types/global-components.d.ts index f07958a6e5..238f62cf0b 100644 --- a/types/global-components.d.ts +++ b/types/global-components.d.ts @@ -120,6 +120,7 @@ declare module "vue" { } interface ComponentCustomProperties { + $storage: ResponsiveStorage; $message: (typeof import("element-plus"))["ElMessage"]; $notify: (typeof import("element-plus"))["ElNotification"]; $msgbox: (typeof import("element-plus"))["ElMessageBox"]; From bbdd44a9178be01a5ce2b0371b1cac47e3ee22b2 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Thu, 19 Dec 2024 17:29:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=BB=91?= =?UTF-8?q?=E5=9D=97=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yaml | 1 + locales/zh-CN.yaml | 1 + src/components/ReText/src/index.vue | 2 +- src/layout/components/lay-footer/index.vue | 2 +- src/router/modules/components.ts | 16 +++-- .../components/slider/components/Base.vue | 64 +++++++++++++++++++ .../components/slider/components/Input.vue | 24 +++++++ .../components/slider/components/Marks.vue | 43 +++++++++++++ .../slider/components/Placement.vue | 40 ++++++++++++ .../components/slider/components/Range.vue | 24 +++++++ .../components/slider/components/Size.vue | 23 +++++++ .../components/slider/components/Step.vue | 45 +++++++++++++ .../components/slider/components/Vertical.vue | 24 +++++++ .../components/slider/components/index.ts | 8 +++ src/views/components/slider/index.vue | 56 ++++++++++++++++ src/views/components/text.vue | 2 +- src/views/components/upload/form.vue | 2 +- src/views/table/virtual/list.vue | 2 +- src/views/table/virtual/pageList.vue | 2 +- src/views/table/virtual/treeList.vue | 2 +- .../vue-flow/layouting/animationEdge.vue | 2 +- src/views/vue-flow/layouting/icon.vue | 2 +- src/views/vue-flow/layouting/index.vue | 2 +- src/views/vue-flow/layouting/processNode.vue | 2 +- 24 files changed, 375 insertions(+), 16 deletions(-) create mode 100644 src/views/components/slider/components/Base.vue create mode 100644 src/views/components/slider/components/Input.vue create mode 100644 src/views/components/slider/components/Marks.vue create mode 100644 src/views/components/slider/components/Placement.vue create mode 100644 src/views/components/slider/components/Range.vue create mode 100644 src/views/components/slider/components/Size.vue create mode 100644 src/views/components/slider/components/Step.vue create mode 100644 src/views/components/slider/components/Vertical.vue create mode 100644 src/views/components/slider/components/index.ts create mode 100644 src/views/components/slider/index.vue diff --git a/locales/en.yaml b/locales/en.yaml index 2aa5a24cf5..2f3b01ef6f 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -92,6 +92,7 @@ menus: pureDraggable: Draggable pureSplitPane: Split Pane pureText: Text Ellipsis + pureSlider: Slider pureElButton: Button pureButton: Button Animation pureCheckButton: Check Button diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index 0287a09558..7b039f33ec 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -92,6 +92,7 @@ menus: pureDraggable: 拖拽 pureSplitPane: 切割面板 pureText: 文本省略 + pureSlider: 滑块 pureElButton: 按钮 pureCheckButton: 可选按钮 pureButton: 按钮动效 diff --git a/src/components/ReText/src/index.vue b/src/components/ReText/src/index.vue index ecaebdbb8e..eddf70ba18 100644 --- a/src/components/ReText/src/index.vue +++ b/src/components/ReText/src/index.vue @@ -1,4 +1,4 @@ - + + + + diff --git a/src/views/components/slider/components/Input.vue b/src/views/components/slider/components/Input.vue new file mode 100644 index 0000000000..78928d3ca8 --- /dev/null +++ b/src/views/components/slider/components/Input.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/src/views/components/slider/components/Marks.vue b/src/views/components/slider/components/Marks.vue new file mode 100644 index 0000000000..b3867296e1 --- /dev/null +++ b/src/views/components/slider/components/Marks.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/views/components/slider/components/Placement.vue b/src/views/components/slider/components/Placement.vue new file mode 100644 index 0000000000..5d09999294 --- /dev/null +++ b/src/views/components/slider/components/Placement.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/src/views/components/slider/components/Range.vue b/src/views/components/slider/components/Range.vue new file mode 100644 index 0000000000..bf17ea3a7c --- /dev/null +++ b/src/views/components/slider/components/Range.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/src/views/components/slider/components/Size.vue b/src/views/components/slider/components/Size.vue new file mode 100644 index 0000000000..c31c382f4c --- /dev/null +++ b/src/views/components/slider/components/Size.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/src/views/components/slider/components/Step.vue b/src/views/components/slider/components/Step.vue new file mode 100644 index 0000000000..3783af8e25 --- /dev/null +++ b/src/views/components/slider/components/Step.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/src/views/components/slider/components/Vertical.vue b/src/views/components/slider/components/Vertical.vue new file mode 100644 index 0000000000..c5e11922bf --- /dev/null +++ b/src/views/components/slider/components/Vertical.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/src/views/components/slider/components/index.ts b/src/views/components/slider/components/index.ts new file mode 100644 index 0000000000..ad8ac28a4b --- /dev/null +++ b/src/views/components/slider/components/index.ts @@ -0,0 +1,8 @@ +export { default as Base } from "./Base.vue"; +export { default as Step } from "./Step.vue"; +export { default as Size } from "./Size.vue"; +export { default as Input } from "./Input.vue"; +export { default as Range } from "./Range.vue"; +export { default as Marks } from "./Marks.vue"; +export { default as Vertical } from "./Vertical.vue"; +export { default as Placement } from "./Placement.vue"; diff --git a/src/views/components/slider/index.vue b/src/views/components/slider/index.vue new file mode 100644 index 0000000000..8ab1134cde --- /dev/null +++ b/src/views/components/slider/index.vue @@ -0,0 +1,56 @@ + + + diff --git a/src/views/components/text.vue b/src/views/components/text.vue index 20f609da5e..fa4f4236c3 100644 --- a/src/views/components/text.vue +++ b/src/views/components/text.vue @@ -1,4 +1,4 @@ -