Skip to content

Commit 698daf4

Browse files
authored
fix: form component events bind (#5137)
* fix: from component events bind * chore: update docs * chore: default value and docs sync
1 parent 0410f1e commit 698daf4

File tree

6 files changed

+6
-12
lines changed

6 files changed

+6
-12
lines changed

apps/web-ele/src/adapter/form.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ setupVbenForm<ComponentType>({
1414
Upload: 'fileList',
1515
CheckboxGroup: 'model-value',
1616
},
17-
// select等组件的筛选功能会抛出input事件,需要禁用表单的input事件监听以免错误地更新了组件值
18-
disabledOnInputListener: true,
1917
},
2018
defineRules: {
2119
required: (value, _params, ctx) => {

apps/web-naive/src/adapter/form.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import { $t } from '@vben/locales';
1010

1111
setupVbenForm<ComponentType>({
1212
config: {
13-
// naive-ui组件不接受onChang事件,所以需要禁用
14-
disabledOnChangeListener: true,
1513
// naive-ui组件的空值为null,不能是undefined,否则重置表单时不生效
1614
emptyStateValue: null,
1715
baseModelPropName: 'value',

docs/src/_env/adapter/form.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ initComponentAdapter();
1414
setupVbenForm<ComponentType>({
1515
config: {
1616
baseModelPropName: 'value',
17-
// naive-ui组件不接受onChang事件,所以需要禁用
18-
disabledOnChangeListener: true,
1917
// naive-ui组件的空值为null,不能是undefined,否则重置表单时不生效
2018
emptyStateValue: null,
2119
modelPropNameMap: {

packages/@core/ui-kit/form-ui/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export function setupVbenForm<
4545
const { config, defineRules } = options;
4646

4747
const {
48-
disabledOnChangeListener = false,
49-
disabledOnInputListener = false,
48+
disabledOnChangeListener = true,
49+
disabledOnInputListener = true,
5050
emptyStateValue = undefined,
5151
} = (config || {}) as FormCommonConfig;
5252

packages/@core/ui-kit/form-ui/src/form-render/form.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ const computedSchema = computed(
8989
componentProps = {},
9090
controlClass = '',
9191
disabled,
92-
disabledOnChangeListener = false,
93-
disabledOnInputListener = false,
92+
disabledOnChangeListener = true,
93+
disabledOnInputListener = true,
9494
emptyStateValue = undefined,
9595
formFieldProps = {},
9696
formItemClass = '',

packages/@core/ui-kit/form-ui/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ export interface FormCommonConfig {
151151
disabled?: boolean;
152152
/**
153153
* 是否禁用所有表单项的change事件监听
154-
* @default false
154+
* @default true
155155
*/
156156
disabledOnChangeListener?: boolean;
157157
/**
158158
* 是否禁用所有表单项的input事件监听
159-
* @default false
159+
* @default true
160160
*/
161161
disabledOnInputListener?: boolean;
162162
/**

0 commit comments

Comments
 (0)