From 33b7a605c037507eef6031b20371c9916b843b24 Mon Sep 17 00:00:00 2001 From: Jin Mao Date: Wed, 22 Oct 2025 18:14:42 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=B8=80=E4=BA=9B=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=92=8C=E5=85=BC=E5=AE=B9=E6=80=A7=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-tdesign/.env | 4 +- .../src/adapter/component/index.ts | 21 +++++++++- apps/web-tdesign/src/adapter/form.ts | 14 +++---- apps/web-tdesign/src/app.vue | 41 ++++++++----------- 4 files changed, 43 insertions(+), 37 deletions(-) diff --git a/apps/web-tdesign/.env b/apps/web-tdesign/.env index 19735f36..dae0149d 100644 --- a/apps/web-tdesign/.env +++ b/apps/web-tdesign/.env @@ -1,8 +1,8 @@ # 应用标题 -VITE_APP_TITLE=Vben Admin Antd +VITE_APP_TITLE=Vben Admin Tdesign # 应用命名空间,用于缓存、store等功能的前缀,确保隔离 -VITE_APP_NAMESPACE=vben-web-antd +VITE_APP_NAMESPACE=vben-web-tdesign # 对store进行加密的密钥,在将store持久化到localStorage时会使用该密钥进行加密 VITE_APP_STORE_SECURE_KEY=please-replace-me-with-your-own-key diff --git a/apps/web-tdesign/src/adapter/component/index.ts b/apps/web-tdesign/src/adapter/component/index.ts index 1ba19baf..0d1423f1 100644 --- a/apps/web-tdesign/src/adapter/component/index.ts +++ b/apps/web-tdesign/src/adapter/component/index.ts @@ -9,6 +9,7 @@ import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { $t } from '@vben/locales'; import { notification } from 'ant-design-vue'; + /** * 通用组件共同的使用的基础组件,原先放在 adapter/form 内部,限制了使用范围,这里提取出来,方便其他地方使用 * 可用于 vben-form、vben-modal、vben-drawer 等组件使用, @@ -178,11 +179,27 @@ async function initComponentAdapter() { // Mentions: withDefaultPlaceholder(Mentions, 'input'), // 自定义主要按钮 PrimaryButton: (props, { attrs, slots }) => { - return h(Button, { ...props, attrs, theme: 'primary' }, slots); + let ghost = false; + let variant = props.variant; + if (props.variant === 'ghost') { + ghost = true; + variant = 'base'; + } + return h( + Button, + { ...props, ghost, variant, attrs, theme: 'default' }, + slots, + ); }, Radio, RadioGroup, - RangePicker, + RangePicker: (props, { attrs, slots }) => { + return h( + RangePicker, + { ...props, modelValue: props.modelValue ?? [], attrs }, + slots, + ); + }, Rate, Select: withDefaultPlaceholder(Select, 'select'), Space, diff --git a/apps/web-tdesign/src/adapter/form.ts b/apps/web-tdesign/src/adapter/form.ts index 983a7f51..a270a960 100644 --- a/apps/web-tdesign/src/adapter/form.ts +++ b/apps/web-tdesign/src/adapter/form.ts @@ -1,17 +1,13 @@ -import type { - VbenFormSchema as FormSchema, - VbenFormProps, -} from '@vben/common-ui'; +import type { VbenFormProps, VbenFormSchema as FormSchema } from "@vben/common-ui"; +import { setupVbenForm, useVbenForm as useForm, z } from "@vben/common-ui"; -import type { ComponentType } from './component'; - -import { setupVbenForm, useVbenForm as useForm, z } from '@vben/common-ui'; -import { $t } from '@vben/locales'; +import type { ComponentType } from "./component"; +import { $t } from "@vben/locales"; async function initSetupVbenForm() { setupVbenForm({ config: { - // ant design vue组件库默认都是 v-model:value + // tdesign组件库默认都是 v-model:value baseModelPropName: 'value', // 一些组件是 v-model:checked 或者 v-model:fileList diff --git a/apps/web-tdesign/src/app.vue b/apps/web-tdesign/src/app.vue index bbaccce1..1e6ef826 100644 --- a/apps/web-tdesign/src/app.vue +++ b/apps/web-tdesign/src/app.vue @@ -1,39 +1,32 @@