diff --git a/apps/web-antd/src/adapter/form.ts b/apps/web-antd/src/adapter/form.ts index ba811917..b55b9b0a 100644 --- a/apps/web-antd/src/adapter/form.ts +++ b/apps/web-antd/src/adapter/form.ts @@ -27,13 +27,13 @@ import { Select, Space, Switch, + Textarea, TimePicker, TreeSelect, Upload, } from 'ant-design-vue'; -// 业务表单组件适配 - +// 这里需要自行根据业务组件库进行适配,需要用到的组件都需要在这里类型说明 export type FormComponentType = | 'AutoComplete' | 'Checkbox' @@ -51,6 +51,7 @@ export type FormComponentType = | 'Select' | 'Space' | 'Switch' + | 'Textarea' | 'TimePicker' | 'TreeSelect' | 'Upload' @@ -83,12 +84,16 @@ setupVbenForm({ Select, Space, Switch, + Textarea, TimePicker, TreeSelect, Upload, }, config: { + // ant design vue组件库默认都是 v-model:value baseModelPropName: 'value', + + // 一些组件是 v-model:checked 或者 v-model:fileList modelPropNameMap: { Checkbox: 'checked', Radio: 'checked', @@ -97,12 +102,14 @@ setupVbenForm({ }, }, defineRules: { + // 输入项目必填国际化适配 required: (value, _params, ctx) => { - if ((!value && value !== 0) || value.length === 0) { + if (value === undefined || value === null || value.length === 0) { return $t('formRules.required', [ctx.label]); } return true; }, + // 选择项目必填国际化适配 selectRequired: (value, _params, ctx) => { if (value === undefined || value === null) { return $t('formRules.selectRequired', [ctx.label]); diff --git a/apps/web-ele/src/adapter/form.ts b/apps/web-ele/src/adapter/form.ts index f5aa854e..b4fa0a06 100644 --- a/apps/web-ele/src/adapter/form.ts +++ b/apps/web-ele/src/adapter/form.ts @@ -73,7 +73,7 @@ setupVbenForm({ }, defineRules: { required: (value, _params, ctx) => { - if ((!value && value !== 0) || value.length === 0) { + if (value === undefined || value === null || value.length === 0) { return $t('formRules.required', [ctx.label]); } return true; diff --git a/apps/web-naive/src/adapter/form.ts b/apps/web-naive/src/adapter/form.ts index 30a86a4a..552919af 100644 --- a/apps/web-naive/src/adapter/form.ts +++ b/apps/web-naive/src/adapter/form.ts @@ -82,7 +82,7 @@ setupVbenForm({ }, defineRules: { required: (value, _params, ctx) => { - if ((!value && value !== 0) || value.length === 0) { + if (value === undefined || value === null || value.length === 0) { return $t('formRules.required', [ctx.label]); } return true; diff --git a/docs/.vitepress/components/demo-preview.vue b/docs/.vitepress/components/demo-preview.vue index 2aba9832..4c8829f8 100644 --- a/docs/.vitepress/components/demo-preview.vue +++ b/docs/.vitepress/components/demo-preview.vue @@ -24,14 +24,16 @@ const parsedFiles = computed(() => { class="not-prose relative w-full overflow-x-auto rounded-t-lg px-4 py-6" >
- -
- - ERROR: - - The preview directory does not exist. Please check the 'dir' - parameter. -
+ + +
+ + ERROR: + + The preview directory does not exist. Please check the 'dir' + parameter. +
+
diff --git a/docs/.vitepress/config/zh.mts b/docs/.vitepress/config/zh.mts index e713a31b..bb054217 100644 --- a/docs/.vitepress/config/zh.mts +++ b/docs/.vitepress/config/zh.mts @@ -154,15 +154,19 @@ function sidebarComponents(): DefaultTheme.SidebarItem[] { items: [ { link: 'common-ui/vben-modal', - text: 'Vben Modal 模态框', + text: 'Modal 模态框', }, { link: 'common-ui/vben-drawer', - text: 'Vben Drawer 抽屉', + text: 'Drawer 抽屉', }, { link: 'common-ui/vben-form', - text: 'Vben Form 表单', + text: 'Form 表单', + }, + { + link: 'common-ui/vben-count-to-animator', + text: 'CountToAnimator 数字动画', }, ], }, diff --git a/docs/.vitepress/theme/components/site-layout.vue b/docs/.vitepress/theme/components/site-layout.vue index dbda5597..d643cae9 100644 --- a/docs/.vitepress/theme/components/site-layout.vue +++ b/docs/.vitepress/theme/components/site-layout.vue @@ -1,30 +1,92 @@