From a38cf80ea4f7d92b6f96e843cc17d5b415d4d71e Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Fri, 24 Oct 2025 16:05:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9D=83=E9=99=90=20-=20=E9=83=A8=E9=97=A8=E5=88=86?= =?UTF-8?q?=E9=85=8D=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/components/global/slot.ts | 27 ++ .../components/tree/src/tree-select-panel.vue | 240 ++++++++---------- apps/web-antd/src/views/system/role/data.tsx | 42 ++- .../src/views/system/role/role-auth-modal.vue | 79 +++--- 4 files changed, 199 insertions(+), 189 deletions(-) create mode 100644 apps/web-antd/src/components/global/slot.ts diff --git a/apps/web-antd/src/components/global/slot.ts b/apps/web-antd/src/components/global/slot.ts new file mode 100644 index 00000000..0c4eb02c --- /dev/null +++ b/apps/web-antd/src/components/global/slot.ts @@ -0,0 +1,27 @@ +import { defineComponent, h } from 'vue'; + +/** + * 使用默认插槽来自定义组件 + * 给vbenForm的components使用 + */ +export const DefaultSlot = defineComponent({ + name: 'DefaultSlot', + inheritAttrs: false, + props: { + /** + * 绑定到根节点的div上的属性 + */ + rootDivAttrs: { + type: Object, + default: () => ({}), + }, + }, + render() { + /** + * 获取属性 传递给作用域插槽供外部使用 + */ + const attrs = this.$attrs; + + return h('div', { ...this.rootDivAttrs }, this.$slots.default?.(attrs)); + }, +}); diff --git a/apps/web-antd/src/components/tree/src/tree-select-panel.vue b/apps/web-antd/src/components/tree/src/tree-select-panel.vue index e7597f91..046ee63a 100644 --- a/apps/web-antd/src/components/tree/src/tree-select-panel.vue +++ b/apps/web-antd/src/components/tree/src/tree-select-panel.vue @@ -1,215 +1,170 @@