fix: form component events bind (#5137)

* fix: from component events bind

* chore: update docs

* chore: default value and docs sync
dev-v5
Netfan 2024-12-14 17:42:13 +08:00 committed by GitHub
parent 0410f1e1be
commit 698daf46c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 6 additions and 12 deletions

View File

@ -14,8 +14,6 @@ setupVbenForm<ComponentType>({
Upload: 'fileList',
CheckboxGroup: 'model-value',
},
// select等组件的筛选功能会抛出input事件需要禁用表单的input事件监听以免错误地更新了组件值
disabledOnInputListener: true,
},
defineRules: {
required: (value, _params, ctx) => {

View File

@ -10,8 +10,6 @@ import { $t } from '@vben/locales';
setupVbenForm<ComponentType>({
config: {
// naive-ui组件不接受onChang事件所以需要禁用
disabledOnChangeListener: true,
// naive-ui组件的空值为null,不能是undefined否则重置表单时不生效
emptyStateValue: null,
baseModelPropName: 'value',

View File

@ -14,8 +14,6 @@ initComponentAdapter();
setupVbenForm<ComponentType>({
config: {
baseModelPropName: 'value',
// naive-ui组件不接受onChang事件所以需要禁用
disabledOnChangeListener: true,
// naive-ui组件的空值为null,不能是undefined否则重置表单时不生效
emptyStateValue: null,
modelPropNameMap: {

View File

@ -45,8 +45,8 @@ export function setupVbenForm<
const { config, defineRules } = options;
const {
disabledOnChangeListener = false,
disabledOnInputListener = false,
disabledOnChangeListener = true,
disabledOnInputListener = true,
emptyStateValue = undefined,
} = (config || {}) as FormCommonConfig;

View File

@ -89,8 +89,8 @@ const computedSchema = computed(
componentProps = {},
controlClass = '',
disabled,
disabledOnChangeListener = false,
disabledOnInputListener = false,
disabledOnChangeListener = true,
disabledOnInputListener = true,
emptyStateValue = undefined,
formFieldProps = {},
formItemClass = '',

View File

@ -151,12 +151,12 @@ export interface FormCommonConfig {
disabled?: boolean;
/**
* change
* @default false
* @default true
*/
disabledOnChangeListener?: boolean;
/**
* input
* @default false
* @default true
*/
disabledOnInputListener?: boolean;
/**