fix: form component events bind (#5137)
* fix: from component events bind * chore: update docs * chore: default value and docs syncdev-v5
parent
0410f1e1be
commit
698daf46c7
|
@ -14,8 +14,6 @@ setupVbenForm<ComponentType>({
|
||||||
Upload: 'fileList',
|
Upload: 'fileList',
|
||||||
CheckboxGroup: 'model-value',
|
CheckboxGroup: 'model-value',
|
||||||
},
|
},
|
||||||
// select等组件的筛选功能会抛出input事件,需要禁用表单的input事件监听以免错误地更新了组件值
|
|
||||||
disabledOnInputListener: true,
|
|
||||||
},
|
},
|
||||||
defineRules: {
|
defineRules: {
|
||||||
required: (value, _params, ctx) => {
|
required: (value, _params, ctx) => {
|
||||||
|
|
|
@ -10,8 +10,6 @@ import { $t } from '@vben/locales';
|
||||||
|
|
||||||
setupVbenForm<ComponentType>({
|
setupVbenForm<ComponentType>({
|
||||||
config: {
|
config: {
|
||||||
// naive-ui组件不接受onChang事件,所以需要禁用
|
|
||||||
disabledOnChangeListener: true,
|
|
||||||
// naive-ui组件的空值为null,不能是undefined,否则重置表单时不生效
|
// naive-ui组件的空值为null,不能是undefined,否则重置表单时不生效
|
||||||
emptyStateValue: null,
|
emptyStateValue: null,
|
||||||
baseModelPropName: 'value',
|
baseModelPropName: 'value',
|
||||||
|
|
|
@ -14,8 +14,6 @@ initComponentAdapter();
|
||||||
setupVbenForm<ComponentType>({
|
setupVbenForm<ComponentType>({
|
||||||
config: {
|
config: {
|
||||||
baseModelPropName: 'value',
|
baseModelPropName: 'value',
|
||||||
// naive-ui组件不接受onChang事件,所以需要禁用
|
|
||||||
disabledOnChangeListener: true,
|
|
||||||
// naive-ui组件的空值为null,不能是undefined,否则重置表单时不生效
|
// naive-ui组件的空值为null,不能是undefined,否则重置表单时不生效
|
||||||
emptyStateValue: null,
|
emptyStateValue: null,
|
||||||
modelPropNameMap: {
|
modelPropNameMap: {
|
||||||
|
|
|
@ -45,8 +45,8 @@ export function setupVbenForm<
|
||||||
const { config, defineRules } = options;
|
const { config, defineRules } = options;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
disabledOnChangeListener = false,
|
disabledOnChangeListener = true,
|
||||||
disabledOnInputListener = false,
|
disabledOnInputListener = true,
|
||||||
emptyStateValue = undefined,
|
emptyStateValue = undefined,
|
||||||
} = (config || {}) as FormCommonConfig;
|
} = (config || {}) as FormCommonConfig;
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,8 @@ const computedSchema = computed(
|
||||||
componentProps = {},
|
componentProps = {},
|
||||||
controlClass = '',
|
controlClass = '',
|
||||||
disabled,
|
disabled,
|
||||||
disabledOnChangeListener = false,
|
disabledOnChangeListener = true,
|
||||||
disabledOnInputListener = false,
|
disabledOnInputListener = true,
|
||||||
emptyStateValue = undefined,
|
emptyStateValue = undefined,
|
||||||
formFieldProps = {},
|
formFieldProps = {},
|
||||||
formItemClass = '',
|
formItemClass = '',
|
||||||
|
|
|
@ -151,12 +151,12 @@ export interface FormCommonConfig {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
/**
|
/**
|
||||||
* 是否禁用所有表单项的change事件监听
|
* 是否禁用所有表单项的change事件监听
|
||||||
* @default false
|
* @default true
|
||||||
*/
|
*/
|
||||||
disabledOnChangeListener?: boolean;
|
disabledOnChangeListener?: boolean;
|
||||||
/**
|
/**
|
||||||
* 是否禁用所有表单项的input事件监听
|
* 是否禁用所有表单项的input事件监听
|
||||||
* @default false
|
* @default true
|
||||||
*/
|
*/
|
||||||
disabledOnInputListener?: boolean;
|
disabledOnInputListener?: boolean;
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue