From d08c4789d528c2abd7c2b63144c9512312e8d637 Mon Sep 17 00:00:00 2001 From: majinju Date: Thu, 4 Nov 2021 13:02:33 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E6=9A=82=E6=97=B6=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=BB=98=E8=AE=A4=E5=80=BC=EF=BC=8C=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E4=B8=AD=E5=BA=94=E8=AF=A5=E8=BF=98=E6=9C=89=E5=A4=A7?= =?UTF-8?q?=E9=87=8F=E7=BB=84=E4=BB=B6=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/form/src/form.ts | 14 +++++++------- packages/input/src/input.ts | 18 +++++++++--------- packages/v-x-e-table/src/conf.ts | 8 ++++++-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/packages/form/src/form.ts b/packages/form/src/form.ts index 9fbf1b4b5..58ae4a3b8 100644 --- a/packages/form/src/form.ts +++ b/packages/form/src/form.ts @@ -69,9 +69,9 @@ function getResetValue (value: any, resetValue: any) { export default defineComponent({ name: 'VxeForm', props: { - collapseStatus: { type: Boolean as PropType, default: true }, - loading: Boolean as PropType, - data: Object as PropType, + collapseStatus: { type: Boolean as PropType, default: () => GlobalConfig.form.collapseStatus }, + loading: { type: Boolean as PropType, default: () => GlobalConfig.form.loading }, + data: { type: Object as PropType}, size: { type: String as PropType, default: () => GlobalConfig.form.size || GlobalConfig.size }, span: { type: [String, Number] as PropType, default: () => GlobalConfig.form.span }, align: { type: String as PropType, default: () => GlobalConfig.form.align }, @@ -79,13 +79,13 @@ export default defineComponent({ titleWidth: { type: [String, Number] as PropType, default: () => GlobalConfig.form.titleWidth }, titleColon: { type: Boolean as PropType, default: () => GlobalConfig.form.titleColon }, titleAsterisk: { type: Boolean as PropType, default: () => GlobalConfig.form.titleAsterisk }, - titleOverflow: { type: [Boolean, String] as PropType, default: null }, - className: [String, Function] as PropType, + titleOverflow: { type: [Boolean, String] as PropType, default: () => GlobalConfig.form.titleOverflow }, + className: { type: [String, Function] as PropType, default: () => GlobalConfig.form.className }, items: Array as PropType, rules: Object as PropType, preventSubmit: { type: Boolean as PropType, default: () => GlobalConfig.form.preventSubmit }, - validConfig: Object as PropType, - tooltipConfig: Object as PropType, + validConfig: { type: Object as PropType, default: () => GlobalConfig.form.validConfig }, + tooltipConfig: { type: Object as PropType, default: () => GlobalConfig.form.tooltipConfig }, customLayout: { type: Boolean as PropType, default: () => GlobalConfig.form.customLayout } }, emits: [ diff --git a/packages/input/src/input.ts b/packages/input/src/input.ts index df475ca87..2cd7ff98e 100644 --- a/packages/input/src/input.ts +++ b/packages/input/src/input.ts @@ -83,18 +83,18 @@ export default defineComponent({ name: 'VxeInput', props: { modelValue: [String, Number, Date] as PropType, - immediate: { type: Boolean as PropType, default: true }, + immediate: { type: Boolean as PropType, default: () => GlobalConfig.input.immediate }, name: String as PropType, - type: { type: String as PropType, default: 'text' }, + type: { type: String as PropType, default: () => GlobalConfig.input.type }, clearable: { type: Boolean as PropType, default: () => GlobalConfig.input.clearable }, - readonly: Boolean as PropType, - disabled: Boolean as PropType, - placeholder: String as PropType, - maxlength: [String, Number] as PropType, - autocomplete: { type: String as PropType, default: 'off' }, - align: String as PropType, + readonly: { type: Boolean as PropType, default: () => GlobalConfig.input.readonly }, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.input.disabled }, + placeholder: { type: String as PropType, default: () => GlobalConfig.input.placeholder }, + maxlength: { type: [String, Number] as PropType, default: () => GlobalConfig.input.maxlength }, + autocomplete: { type: String as PropType, default: () => GlobalConfig.input.autocomplete }, + align: { type: String as PropType, default: () => GlobalConfig.input.align }, form: String as PropType, - className: String as PropType, + className: { type: String as PropType, default: () => GlobalConfig.input.className }, size: { type: String as PropType, default: () => GlobalConfig.input.size || GlobalConfig.size }, // number、integer、float diff --git a/packages/v-x-e-table/src/conf.ts b/packages/v-x-e-table/src/conf.ts index f05f5a29f..5b5723509 100644 --- a/packages/v-x-e-table/src/conf.ts +++ b/packages/v-x-e-table/src/conf.ts @@ -245,9 +245,11 @@ const GlobalConfig: VXETableGlobalConfig = { }, // size: null, // colon: false, - titleAsterisk: true + titleAsterisk: true, + collapseStatus: true }, input: { + type: 'text', // size: null, // transfer: false // parseFormat: 'yyyy-MM-dd HH:mm:ss.SSS', @@ -258,7 +260,9 @@ const GlobalConfig: VXETableGlobalConfig = { startDay: 1, selectDay: 1, digits: 2, - controls: true + controls: true, + immediate: true, + autocomplete: 'off' }, textarea: { // size: null, -- Gitee From d2f4ac64e65a4ad39678d01969ffbd75aa403b27 Mon Sep 17 00:00:00 2001 From: majinju Date: Sat, 6 Nov 2021 18:03:05 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E5=A4=A7?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=B8=B8=E7=94=A8=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AE=E6=B2=A1=E7=94=9F=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/form/src/form.ts | 2 +- packages/input/src/input.ts | 14 ++++----- packages/radio/src/group.ts | 11 +++++-- packages/select/src/select.ts | 39 +++++++++++++++--------- packages/switch/src/switch.ts | 14 ++++----- packages/table/src/props.ts | 50 +++++++++++++++---------------- packages/textarea/src/textarea.ts | 24 +++++++-------- packages/toolbar/src/toolbar.ts | 14 ++++----- packages/tooltip/src/tooltip.ts | 8 ++--- packages/v-x-e-table/src/conf.ts | 7 ++++- types/table.d.ts | 3 +- 11 files changed, 105 insertions(+), 81 deletions(-) diff --git a/packages/form/src/form.ts b/packages/form/src/form.ts index 58ae4a3b8..12513c1af 100644 --- a/packages/form/src/form.ts +++ b/packages/form/src/form.ts @@ -71,7 +71,7 @@ export default defineComponent({ props: { collapseStatus: { type: Boolean as PropType, default: () => GlobalConfig.form.collapseStatus }, loading: { type: Boolean as PropType, default: () => GlobalConfig.form.loading }, - data: { type: Object as PropType}, + data: { type: Object as PropType }, size: { type: String as PropType, default: () => GlobalConfig.form.size || GlobalConfig.size }, span: { type: [String, Number] as PropType, default: () => GlobalConfig.form.span }, align: { type: String as PropType, default: () => GlobalConfig.form.align }, diff --git a/packages/input/src/input.ts b/packages/input/src/input.ts index 2cd7ff98e..228fcafe6 100644 --- a/packages/input/src/input.ts +++ b/packages/input/src/input.ts @@ -98,9 +98,9 @@ export default defineComponent({ size: { type: String as PropType, default: () => GlobalConfig.input.size || GlobalConfig.size }, // number、integer、float - min: { type: [String, Number] as PropType, default: null }, - max: { type: [String, Number] as PropType, default: null }, - step: [String, Number] as PropType, + min: { type: [String, Number] as PropType, default: () => GlobalConfig.input.min }, + max: { type: [String, Number] as PropType, default: () => GlobalConfig.input.max }, + step: { type: [String, Number] as PropType, default: () => GlobalConfig.input.step }, exponential: { type: Boolean as PropType, default: () => GlobalConfig.input.exponential }, // number、integer、float、password @@ -117,16 +117,16 @@ export default defineComponent({ startDay: { type: [String, Number] as PropType, default: () => GlobalConfig.input.startDay }, labelFormat: { type: String as PropType, default: () => GlobalConfig.input.labelFormat }, valueFormat: { type: String as PropType, default: () => GlobalConfig.input.valueFormat }, - editable: { type: Boolean as PropType, default: true }, + editable: { type: Boolean as PropType, default: () => GlobalConfig.input.editable }, festivalMethod: { type: Function as PropType, default: () => GlobalConfig.input.festivalMethod }, disabledMethod: { type: Function as PropType, default: () => GlobalConfig.input.disabledMethod }, // week selectDay: { type: [String, Number] as PropType, default: () => GlobalConfig.input.selectDay }, - prefixIcon: String as PropType, - suffixIcon: String as PropType, - placement: String as PropType, + prefixIcon: { type: String as PropType, default: () => GlobalConfig.input.prefixIcon }, + suffixIcon: { type: String as PropType, default: () => GlobalConfig.input.suffixIcon }, + placement: { type: String as PropType, default: () => GlobalConfig.input.placement }, transfer: { type: Boolean as PropType, default: () => GlobalConfig.input.transfer } }, emits: [ diff --git a/packages/radio/src/group.ts b/packages/radio/src/group.ts index 1099d8866..f724bd83b 100644 --- a/packages/radio/src/group.ts +++ b/packages/radio/src/group.ts @@ -3,13 +3,20 @@ import XEUtils from 'xe-utils' import GlobalConfig from '../../v-x-e-table/src/conf' import { useSize } from '../../hooks/size' -import { VxeRadioGroupPropTypes, VxeRadioGroupConstructor, VxeRadioGroupEmits, VxeRadioGroupPrivateMethods, RadioGroupPrivateMethods, RadioGroupMethods } from '../../../types/all' +import { + VxeRadioGroupPropTypes, + VxeRadioGroupConstructor, + VxeRadioGroupEmits, + VxeRadioGroupPrivateMethods, + RadioGroupPrivateMethods, + RadioGroupMethods +} from '../../../types/all' export default defineComponent({ name: 'VxeRadioGroup', props: { modelValue: [String, Number, Boolean] as PropType, - disabled: Boolean as PropType, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.radio.disabled }, size: { type: String as PropType, default: () => GlobalConfig.radio.size || GlobalConfig.size } }, emits: [ diff --git a/packages/select/src/select.ts b/packages/select/src/select.ts index 5a8a7ac03..a7cc717ae 100644 --- a/packages/select/src/select.ts +++ b/packages/select/src/select.ts @@ -6,7 +6,18 @@ import { getEventTargetNode, getAbsolutePos } from '../../tools/dom' import { getLastZIndex, nextZIndex, getFuncText, formatText } from '../../tools/utils' import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event' -import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeInputConstructor, VxeOptgroupProps, VxeOptionProps } from '../../../types/all' +import { + VxeSelectPropTypes, + VxeSelectConstructor, + SelectReactData, + VxeSelectEmits, + SelectMethods, + SelectPrivateRef, + VxeSelectMethods, + VxeInputConstructor, + VxeOptgroupProps, + VxeOptionProps +} from '../../../types/all' function isOptionVisible (option: any) { return option.visible !== false @@ -20,23 +31,23 @@ export default defineComponent({ name: 'VxeSelect', props: { modelValue: null, - clearable: Boolean as PropType, - placeholder: String as PropType, + clearable: { type: Boolean as PropType, default: () => GlobalConfig.select.clearable }, + placeholder: { type: String as PropType, default: () => GlobalConfig.select.placeholder }, loading: Boolean as PropType, - disabled: Boolean as PropType, - multiple: Boolean as PropType, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.select.disabled }, + multiple: { type: Boolean as PropType, default: () => GlobalConfig.select.multiple }, multiCharOverflow: { type: [Number, String] as PropType, default: () => GlobalConfig.select.multiCharOverflow }, - prefixIcon: String as PropType, - placement: String as PropType, - options: Array as PropType, - optionProps: Object as PropType, - optionGroups: Array as PropType, - optionGroupProps: Object as PropType, - className: [String, Function] as PropType, + prefixIcon: { type: String as PropType, default: () => GlobalConfig.select.prefixIcon }, + placement: { type: String as PropType, default: () => GlobalConfig.select.placement }, + options: { type: Array as PropType, default: () => GlobalConfig.select.options }, + optionProps: { type: Object as PropType, default: () => GlobalConfig.select.optionProps }, + optionGroups: { type: Array as PropType, default: () => GlobalConfig.select.optionGroups }, + optionGroupProps: { type: Object as PropType, default: () => GlobalConfig.select.optionGroupProps }, + className: { type: [String, Function] as PropType, default: () => GlobalConfig.select.className }, size: { type: String as PropType, default: () => GlobalConfig.select.size || GlobalConfig.size }, - emptyText: String as PropType, + emptyText: { type: String as PropType, default: () => GlobalConfig.select.emptyText }, optionId: { type: String as PropType, default: () => GlobalConfig.select.optionId }, - optionKey: Boolean as PropType, + optionKey: { type: Boolean as PropType, default: () => GlobalConfig.select.optionKey }, transfer: { type: Boolean as PropType, default: () => GlobalConfig.select.transfer } }, emits: [ diff --git a/packages/switch/src/switch.ts b/packages/switch/src/switch.ts index a8bb396e4..e27c60d78 100644 --- a/packages/switch/src/switch.ts +++ b/packages/switch/src/switch.ts @@ -10,14 +10,14 @@ export default defineComponent({ name: 'VxeSwitch', props: { modelValue: [String, Number, Boolean] as PropType, - disabled: Boolean as PropType, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.switch.disabled }, size: { type: String as PropType, default: () => GlobalConfig.switch.size || GlobalConfig.size }, - openLabel: String as PropType, - closeLabel: String as PropType, - openValue: { type: [String, Number, Boolean] as PropType, default: true }, - closeValue: { type: [String, Number, Boolean] as PropType, default: false }, - openIcon: String as PropType, - closeIcon: String as PropType + openLabel: { type: String as PropType, default: () => GlobalConfig.switch.openLabel }, + closeLabel: { type: String as PropType, default: () => GlobalConfig.switch.closeLabel }, + openValue: { type: [String, Number, Boolean] as PropType, default: () => GlobalConfig.switch.openValue }, + closeValue: { type: [String, Number, Boolean] as PropType, default: () => GlobalConfig.switch.closeValue }, + openIcon: { type: String as PropType, default: () => GlobalConfig.switch.openIcon }, + closeIcon: { type: String as PropType, default: () => GlobalConfig.switch.closeIcon } }, emits: [ 'update:modelValue', diff --git a/packages/table/src/props.ts b/packages/table/src/props.ts index 586d8e207..9b33a3b64 100644 --- a/packages/table/src/props.ts +++ b/packages/table/src/props.ts @@ -9,9 +9,9 @@ export default { // 数据 data: Array as PropType, // 表格的高度 - height: [Number, String] as PropType, + height: { type: [Number, String] as PropType, default: () => GlobalConfig.table.height }, // 表格的最大高度 - maxHeight: [Number, String] as PropType, + maxHeight: { type: [Number, String] as PropType, default: () => GlobalConfig.table.maxHeight }, // 所有列是否允许拖动列宽调整大小 resizable: { type: Boolean as PropType, default: () => GlobalConfig.table.resizable }, // 是否带有斑马纹 @@ -43,43 +43,43 @@ export default { // 鼠标移到列是否要高亮显示 highlightHoverColumn: { type: Boolean as PropType, default: () => GlobalConfig.table.highlightHoverColumn }, // 激活单元格编辑时是否高亮显示 - highlightCell: Boolean as PropType, + highlightCell: { type: Boolean as PropType, default: () => GlobalConfig.table.highlightCell }, // 是否显示表尾合计 - showFooter: Boolean as PropType, + showFooter: { type: Boolean as PropType, default: () => GlobalConfig.table.showFooter }, // 表尾合计的计算方法 - footerMethod: Function as PropType, + footerMethod: { type: Function as PropType, default: () => GlobalConfig.table.footerMethod }, // 给行附加 className - rowClassName: [String, Function] as PropType, + rowClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.rowClassName }, // 给单元格附加 className - cellClassName: [String, Function] as PropType, + cellClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.cellClassName }, // 给表头的行附加 className - headerRowClassName: [String, Function] as PropType, + headerRowClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.headerRowClassName }, // 给表头的单元格附加 className - headerCellClassName: [String, Function] as PropType, + headerCellClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.headerCellClassName }, // 给表尾的行附加 className - footerRowClassName: [String, Function] as PropType, + footerRowClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.footerRowClassName }, // 给表尾的单元格附加 className - footerCellClassName: [String, Function] as PropType, + footerCellClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.footerCellClassName }, // 给单元格附加样式 - cellStyle: [Object, Function] as PropType, + cellStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.cellStyle }, // 给表头单元格附加样式 - headerCellStyle: [Object, Function] as PropType, + headerCellStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.headerCellStyle }, // 给表尾单元格附加样式 - footerCellStyle: [Object, Function] as PropType, + footerCellStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.footerCellStyle }, // 给行附加样式 - rowStyle: [Object, Function] as PropType, + rowStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.rowStyle }, // 给表头行附加样式 - headerRowStyle: [Object, Function] as PropType, + headerRowStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.headerRowStyle }, // 给表尾行附加样式 - footerRowStyle: [Object, Function] as PropType, + footerRowStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.footerRowStyle }, // 合并指定单元格 - mergeCells: Array as PropType, + mergeCells: { type: Array as PropType, default: () => GlobalConfig.table.mergeCells }, // 合并指定的表尾 - mergeFooterItems: Array as PropType, + mergeFooterItems: { type: Array as PropType, default: () => GlobalConfig.table.mergeFooterItems }, // 自定义合并行或列的方法 - spanMethod: Function as PropType, + spanMethod: { type: Function as PropType }, // 表尾合并行或列 - footerSpanMethod: Function as PropType, + footerSpanMethod: { type: Function as PropType }, // 设置所有内容过长时显示为省略号 showOverflow: { type: [Boolean, String] as PropType, default: () => GlobalConfig.table.showOverflow }, // 设置表头所有内容过长时显示为省略号 @@ -89,16 +89,16 @@ export default { /** 高级属性 */ // 主键配置 - columnKey: Boolean as PropType, - rowKey: Boolean as PropType, + columnKey: { type: Boolean as PropType, default: () => GlobalConfig.table.columnKey }, + rowKey: { type: Boolean as PropType, default: () => GlobalConfig.table.rowKey }, rowId: { type: String as PropType, default: () => GlobalConfig.table.rowId }, - zIndex: Number as PropType, + zIndex: { type: Number as PropType, default: () => GlobalConfig.table.zIndex }, emptyText: { type: String as PropType, default: () => GlobalConfig.table.emptyText }, keepSource: { type: Boolean as PropType, default: () => GlobalConfig.table.keepSource }, // 是否自动监听父容器变化去更新响应式表格宽高 autoResize: { type: Boolean as PropType, default: () => GlobalConfig.table.autoResize }, // 是否自动根据状态属性去更新响应式表格宽高 - syncResize: [Boolean, String, Number], + syncResize: { type: [Boolean, String, Number], default: () => GlobalConfig.table.syncResize }, // 列配置信息 columnConfig: Object as PropType, // 行配置信息 diff --git a/packages/textarea/src/textarea.ts b/packages/textarea/src/textarea.ts index 40220e7be..c003e7752 100644 --- a/packages/textarea/src/textarea.ts +++ b/packages/textarea/src/textarea.ts @@ -12,19 +12,19 @@ export default defineComponent({ name: 'VxeTextarea', props: { modelValue: [String, Number] as PropType, - className: String as PropType, - immediate: { type: Boolean as PropType, default: true }, + className: { type: String as PropType, default: () => GlobalConfig.textarea.className }, + immediate: { type: Boolean as PropType, default: () => GlobalConfig.textarea.immediate }, name: String as PropType, - readonly: Boolean as PropType, - disabled: Boolean as PropType, - placeholder: String as PropType, - maxlength: [String, Number] as PropType, - rows: { type: [String, Number] as PropType, default: 2 }, - cols: { type: [String, Number] as PropType, default: null }, - showWordCount: Boolean as PropType, - countMethod: Function as PropType, - autosize: [Boolean, Object] as PropType, - form: String as PropType, + readonly: { type: Boolean as PropType, default: () => GlobalConfig.textarea.readonly }, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.textarea.disabled }, + placeholder: { type: String as PropType, default: () => GlobalConfig.textarea.placeholder }, + maxlength: { type: [String, Number] as PropType, default: () => GlobalConfig.textarea.maxlength }, + rows: { type: [String, Number] as PropType, default: () => GlobalConfig.textarea.rows }, + cols: { type: [String, Number] as PropType, default: () => GlobalConfig.textarea.cols }, + showWordCount: { type: Boolean as PropType, default: () => GlobalConfig.textarea.showWordCount }, + countMethod: { type: Function as PropType, default: () => GlobalConfig.textarea.countMethod }, + autosize: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.textarea.autosize }, + form: { type: String as PropType, default: () => GlobalConfig.textarea.form }, resize: { type: String as PropType, default: () => GlobalConfig.textarea.resize }, size: { type: String as PropType, default: () => GlobalConfig.textarea.size || GlobalConfig.size } }, diff --git a/packages/toolbar/src/toolbar.ts b/packages/toolbar/src/toolbar.ts index c4516f4e8..dce256a69 100644 --- a/packages/toolbar/src/toolbar.ts +++ b/packages/toolbar/src/toolbar.ts @@ -13,17 +13,17 @@ export default defineComponent({ name: 'VxeToolbar', props: { loading: Boolean, - refresh: [Boolean, Object] as PropType, - import: [Boolean, Object] as PropType, - export: [Boolean, Object] as PropType, - print: [Boolean, Object] as PropType, - zoom: [Boolean, Object] as PropType< VxeToolbarPropTypes.Zoom>, - custom: [Boolean, Object] as PropType, + refresh: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.refresh }, + import: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.import }, + export: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.export }, + print: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.print }, + zoom: { type: [Boolean, Object] as PropType< VxeToolbarPropTypes.Zoom>, default: () => GlobalConfig.toolbar.zoom }, + custom: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.custom }, buttons: { type: Array as PropType, default: () => GlobalConfig.toolbar.buttons }, tools: { type: Array as PropType, default: () => GlobalConfig.toolbar.tools }, perfect: { type: Boolean as PropType, default: () => GlobalConfig.toolbar.perfect }, size: { type: String as PropType, default: () => GlobalConfig.toolbar.size || GlobalConfig.size }, - className: [String, Function] as PropType + className: { type: [String, Function] as PropType, default: () => GlobalConfig.toolbar.className } }, emits: [ 'button-click', diff --git a/packages/tooltip/src/tooltip.ts b/packages/tooltip/src/tooltip.ts index 353475a0d..cdebb3edd 100644 --- a/packages/tooltip/src/tooltip.ts +++ b/packages/tooltip/src/tooltip.ts @@ -14,12 +14,12 @@ export default defineComponent({ size: { type: String as PropType, default: () => GlobalConfig.tooltip.size || GlobalConfig.size }, trigger: { type: String as PropType, default: () => GlobalConfig.tooltip.trigger }, theme: { type: String as PropType, default: () => GlobalConfig.tooltip.theme }, - content: [String, Number] as PropType, - zIndex: [String, Number] as PropType, + content: { type: [String, Number] as PropType, default: () => GlobalConfig.tooltip.content }, + zIndex: { type: [String, Number] as PropType, default: () => GlobalConfig.tooltip.zIndex }, isArrow: { type: Boolean as PropType, default: true }, - enterable: Boolean as PropType, + enterable: { type: Boolean as PropType, default: () => GlobalConfig.tooltip.enterable }, leaveDelay: { type: Number as PropType, default: () => GlobalConfig.tooltip.leaveDelay }, - leaveMethod: Function as PropType + leaveMethod: { type: Function as PropType, default: () => GlobalConfig.tooltip.leaveMethod } }, emits: [ 'update:modelValue' diff --git a/packages/v-x-e-table/src/conf.ts b/packages/v-x-e-table/src/conf.ts index 06d8df312..3b73655e2 100644 --- a/packages/v-x-e-table/src/conf.ts +++ b/packages/v-x-e-table/src/conf.ts @@ -262,7 +262,8 @@ const GlobalConfig: VXETableGlobalConfig = { digits: 2, controls: true, immediate: true, - autocomplete: 'off' + autocomplete: 'off', + editable: true }, textarea: { // size: null, @@ -270,6 +271,8 @@ const GlobalConfig: VXETableGlobalConfig = { // minRows: 1, // maxRows: 10 // } + immediate: true, + rows: 2 }, select: { // size: null, @@ -301,6 +304,8 @@ const GlobalConfig: VXETableGlobalConfig = { }, switch: { // size: null + openValue: true, + closeValue: false }, modal: { // size: null, diff --git a/types/table.d.ts b/types/table.d.ts index af4cd7b01..c08f99b88 100644 --- a/types/table.d.ts +++ b/types/table.d.ts @@ -1946,6 +1946,7 @@ export type VxeTableProps = { columnKey?: VxeTablePropTypes.ColumnKey; rowKey?: VxeTablePropTypes.RowKey; rowId?: VxeTablePropTypes.RowId; + zIndex?:VxeTablePropTypes.ZIndex; keepSource?: VxeTablePropTypes.KeepSource; autoResize?: VxeTablePropTypes.AutoResize; syncResize?: VxeTablePropTypes.SyncResize; @@ -2484,4 +2485,4 @@ export namespace VxeTableEvents { export type ValidError = (params: VxeTableDefines.ValidErrorEventParams) => void; export type Scroll = (params: VxeTableDefines.ScrollEventParams) => void; export type Custom = (params: VxeTableDefines.CustomEventParams) => void; -} \ No newline at end of file +} -- Gitee From 7d903ee1006bee317ded8f19f10be030e9f3e9f9 Mon Sep 17 00:00:00 2001 From: majinju Date: Sat, 6 Nov 2021 19:12:34 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9modal=E7=9A=84=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E9=85=8D=E7=BD=AE=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/modal/src/modal.ts | 32 ++++++++++++++++---------------- packages/v-x-e-table/src/conf.ts | 3 ++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/modal/src/modal.ts b/packages/modal/src/modal.ts index 1c924084c..48cabafcb 100644 --- a/packages/modal/src/modal.ts +++ b/packages/modal/src/modal.ts @@ -17,37 +17,37 @@ export default defineComponent({ props: { modelValue: Boolean as PropType, id: String as PropType, - type: { type: String as PropType, default: 'modal' }, - loading: { type: Boolean as PropType, default: null }, - status: String as PropType, - iconStatus: String as PropType, - className: String as PropType, + type: { type: String as PropType, default: () => GlobalConfig.modal.type }, + loading: { type: Boolean as PropType, default: () => GlobalConfig.modal.loading }, + status: { type: String as PropType, default: () => GlobalConfig.modal.status }, + iconStatus: { type: String as PropType, default: () => GlobalConfig.modal.iconStatus }, + className: { type: String as PropType, default: () => GlobalConfig.modal.className }, top: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.top }, - position: [String, Object] as PropType, - title: String as PropType, + position: { type: [String, Object] as PropType, default: () => GlobalConfig.modal.position }, + title: { type: String as PropType, default: () => GlobalConfig.modal.title }, duration: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.duration }, - message: [Number, String] as PropType, - content: [Number, String] as PropType, + message: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.message }, + content: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.content }, cancelButtonText: { type: String as PropType, default: () => GlobalConfig.modal.cancelButtonText }, confirmButtonText: { type: String as PropType, default: () => GlobalConfig.modal.confirmButtonText }, lockView: { type: Boolean as PropType, default: () => GlobalConfig.modal.lockView }, - lockScroll: Boolean as PropType, + lockScroll: { type: Boolean as PropType, default: () => GlobalConfig.modal.lockScroll }, mask: { type: Boolean as PropType, default: () => GlobalConfig.modal.mask }, maskClosable: { type: Boolean as PropType, default: () => GlobalConfig.modal.maskClosable }, escClosable: { type: Boolean as PropType, default: () => GlobalConfig.modal.escClosable }, - resize: Boolean as PropType, + resize: { type: Boolean as PropType, default: () => GlobalConfig.modal.resize }, showHeader: { type: Boolean as PropType, default: () => GlobalConfig.modal.showHeader }, showFooter: { type: Boolean as PropType, default: () => GlobalConfig.modal.showFooter }, - showZoom: Boolean as PropType, + showZoom: { type: Boolean as PropType, default: () => GlobalConfig.modal.showZoom }, showClose: { type: Boolean as PropType, default: () => GlobalConfig.modal.showClose }, dblclickZoom: { type: Boolean as PropType, default: () => GlobalConfig.modal.dblclickZoom }, - width: [Number, String] as PropType, - height: [Number, String] as PropType, + width: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.width }, + height: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.height }, minWidth: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.minWidth }, minHeight: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.minHeight }, - zIndex: Number as PropType, + zIndex: { type: Number as PropType, default: () => GlobalConfig.modal.zIndex }, marginSize: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.marginSize }, - fullscreen: Boolean as PropType, + fullscreen: { type: Boolean as PropType, default: () => GlobalConfig.modal.fullscreen }, draggable: { type: Boolean as PropType, default: () => GlobalConfig.modal.draggable }, remember: { type: Boolean, default: () => GlobalConfig.modal.remember }, destroyOnClose: { type: Boolean as PropType, default: () => GlobalConfig.modal.destroyOnClose }, diff --git a/packages/v-x-e-table/src/conf.ts b/packages/v-x-e-table/src/conf.ts index 3b73655e2..2f7645463 100644 --- a/packages/v-x-e-table/src/conf.ts +++ b/packages/v-x-e-table/src/conf.ts @@ -323,7 +323,8 @@ const GlobalConfig: VXETableGlobalConfig = { showClose: true, draggable: true, // storage: false, - storageKey: 'VXE_MODAL_POSITION' + storageKey: 'VXE_MODAL_POSITION', + type: 'modal' }, list: { // size: null, -- Gitee From a229b2d1117e1d904f3a041b14d618f8d3da8006 Mon Sep 17 00:00:00 2001 From: majinju Date: Sun, 7 Nov 2021 10:32:30 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E8=B0=83=E6=95=B4switch=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=A0=B7=E5=BC=8F=EF=BC=8C=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E5=9C=A8=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80=E4=B8=BAmini?= =?UTF-8?q?=E6=97=B6=E4=BC=9A=E5=AF=BC=E8=87=B4=E6=A0=85=E6=A0=BC=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E4=B8=8B=E6=96=B9=E8=A2=AB=E6=8C=A4=E8=B5=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/switch.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/switch.scss b/styles/switch.scss index 7a7149377..0d3a4c8fd 100644 --- a/styles/switch.scss +++ b/styles/switch.scss @@ -4,7 +4,7 @@ display: inline-block; color: $vxe-font-color; vertical-align: middle; - padding: 0.4em; + padding: 0.3em; user-select: none; text-align: center; &.is--animat { -- Gitee From 300093ecabc7f42b06601dd63f716c95fca219d5 Mon Sep 17 00:00:00 2001 From: majinju Date: Sun, 7 Nov 2021 14:36:50 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E7=BB=99=E6=8C=89=E9=92=AE=E5=92=8C?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=A1=B9=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/button/src/button.ts | 24 ++++++++++++------------ packages/form/src/form-item.ts | 30 +++++++++++++++--------------- packages/v-x-e-table/src/conf.ts | 3 +++ types/v-x-e-table/setup.d.ts | 2 ++ 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/packages/button/src/button.ts b/packages/button/src/button.ts index 39053f44d..a388a2317 100644 --- a/packages/button/src/button.ts +++ b/packages/button/src/button.ts @@ -14,8 +14,8 @@ export default defineComponent({ /** * 按钮类型 */ - type: String as PropType, - className: String as PropType, + type: { type: String as PropType, default: () => GlobalConfig.button.type }, + className: { type: String as PropType, default: () => GlobalConfig.button.className }, /** * 按钮尺寸 */ @@ -23,43 +23,43 @@ export default defineComponent({ /** * 用来标识这一项 */ - name: [String, Number] as PropType, + name: { type: [String, Number] as PropType, default: () => GlobalConfig.button.name }, /** * 按钮内容 */ - content: String as PropType, + content: { type: String as PropType, default: () => GlobalConfig.button.content }, /** * 固定显示下拉面板的方向 */ - placement: String as PropType, + placement: { type: String as PropType, default: () => GlobalConfig.button.placement }, /** * 按钮状态 */ - status: String as PropType, + status: { type: String as PropType, default: () => GlobalConfig.button.status }, /** * 按钮的图标 */ - icon: String as PropType, + icon: { type: String as PropType, default: () => GlobalConfig.button.icon }, /** * 圆角边框 */ - round: Boolean as PropType, + round: { type: Boolean as PropType, default: () => GlobalConfig.button.round }, /** * 圆角按钮 */ - circle: Boolean as PropType, + circle: { type: Boolean as PropType, default: () => GlobalConfig.button.circle }, /** * 是否禁用 */ - disabled: Boolean as PropType, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.button.disabled }, /** * 是否加载中 */ - loading: Boolean as PropType, + loading: { type: Boolean as PropType, default: () => GlobalConfig.button.loading }, /** * 在下拉面板关闭时销毁内容 */ - destroyOnClose: Boolean as PropType, + destroyOnClose: { type: Boolean as PropType, default: () => GlobalConfig.button.destroyOnClose }, /** * 是否将弹框容器插入于 body 内 */ diff --git a/packages/form/src/form-item.ts b/packages/form/src/form-item.ts index 8ec55935d..fb52206be 100644 --- a/packages/form/src/form-item.ts +++ b/packages/form/src/form-item.ts @@ -9,22 +9,22 @@ import { renderTitle } from './render' import { VxeFormConstructor, VxeFormDefines, VxeFormItemPropTypes, VxeFormPrivateMethods } from '../../../types/all' export const formItemProps = { - title: String as PropType, + title: { type: String as PropType, default: () => GlobalConfig.formItem.title }, field: String as PropType, - span: [String, Number] as PropType, - align: String as PropType, - titleAlign: String as PropType, - titleWidth: [String, Number] as PropType, - className: [String, Function] as PropType, - titleOverflow: { type: [Boolean, String] as PropType, default: null }, - titlePrefix: Object as PropType, - titleSuffix: Object as PropType, - resetValue: { default: null }, - visibleMethod: Function as PropType, - visible: { type: Boolean as PropType, default: null }, - folding: Boolean as PropType, - collapseNode: Boolean as PropType, - itemRender: Object as PropType + span: { type: [String, Number] as PropType, default: () => GlobalConfig.formItem.span }, + align: { type: String as PropType, default: () => GlobalConfig.formItem.align }, + titleAlign: { type: String as PropType, default: () => GlobalConfig.formItem.titleAlign }, + titleWidth: { type: [String, Number] as PropType, default: () => GlobalConfig.formItem.titleWidth }, + className: { type: [String, Function] as PropType, default: () => GlobalConfig.formItem.className }, + titleOverflow: { type: [Boolean, String] as PropType, default: () => GlobalConfig.formItem.titleOverflow }, + titlePrefix: { type: Object as PropType, default: () => GlobalConfig.formItem.titlePrefix }, + titleSuffix: { type: Object as PropType, default: () => GlobalConfig.formItem.titleSuffix }, + resetValue: { type: Object as PropType, default: () => GlobalConfig.formItem.resetValue }, + visibleMethod: { type: Function as PropType, default: () => GlobalConfig.formItem.visibleMethod }, + visible: { type: Boolean as PropType, default: () => GlobalConfig.formItem.visible }, + folding: { type: Boolean as PropType, default: () => GlobalConfig.formItem.folding }, + collapseNode: { type: Boolean as PropType, default: () => GlobalConfig.formItem.collapseNode }, + itemRender: { type: Object as PropType, default: () => GlobalConfig.formItem.itemRender } } export default defineComponent({ diff --git a/packages/v-x-e-table/src/conf.ts b/packages/v-x-e-table/src/conf.ts index 2f7645463..a95a2e449 100644 --- a/packages/v-x-e-table/src/conf.ts +++ b/packages/v-x-e-table/src/conf.ts @@ -248,6 +248,9 @@ const GlobalConfig: VXETableGlobalConfig = { titleAsterisk: true, collapseStatus: true }, + formItem: { + // span: 8 + }, input: { type: 'text', // size: null, diff --git a/types/v-x-e-table/setup.d.ts b/types/v-x-e-table/setup.d.ts index 9b057a542..79cb5df80 100644 --- a/types/v-x-e-table/setup.d.ts +++ b/types/v-x-e-table/setup.d.ts @@ -14,6 +14,7 @@ import { VxeTextareaProps } from '../textarea' import { VxeButtonProps } from '../button' import { VxeCheckboxProps } from '../checkbox' import { VxeRadioProps } from '../radio' +import {VxeFormItemProps, VxeFormItemPropTypes} from "../form-item"; export interface VXETableSetupOptions { size?: SizeType; @@ -68,6 +69,7 @@ export interface VXETableGlobalConfig extends VXETableSetupOptions { tooltip: VxeTooltipProps; pager: VxePagerProps; form: VxeFormProps; + formItem: VxeFormItemProps; input: VxeInputProps; textarea: VxeTextareaProps; select: VxeSelectProps; -- Gitee From 03ddfdca891e7c6211762f99ebbdcc886450bc66 Mon Sep 17 00:00:00 2001 From: majinju Date: Tue, 9 Nov 2021 09:08:50 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E7=BB=99=E5=88=86=E9=A1=B5=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=8A=A0=E4=B8=8A=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E3=80=82=20=E8=A7=A3=E5=86=B3=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E5=9C=A8item-render=E5=86=85=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E6=98=AF=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/pager/src/pager.ts | 12 ++++++------ packages/v-x-e-table/src/conf.ts | 8 ++++---- styles/pager.scss | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/pager/src/pager.ts b/packages/pager/src/pager.ts index ab0a03445..f1c657b77 100644 --- a/packages/pager/src/pager.ts +++ b/packages/pager/src/pager.ts @@ -35,13 +35,13 @@ export default defineComponent({ // 当只有一页时隐藏 autoHidden: { type: Boolean as PropType, default: () => GlobalConfig.pager.autoHidden }, transfer: { type: Boolean as PropType, default: () => GlobalConfig.pager.transfer }, - className: [String, Function] as PropType, + className: { type: [String, Function] as PropType, default: () => GlobalConfig.pager.className }, // 自定义图标 - iconPrevPage: String as PropType, - iconJumpPrev: String as PropType, - iconJumpNext: String as PropType, - iconNextPage: String as PropType, - iconJumpMore: String as PropType + iconPrevPage: { type: String as PropType, default: () => GlobalConfig.pager.iconPrevPage }, + iconJumpPrev: { type: String as PropType, default: () => GlobalConfig.pager.iconJumpPrev }, + iconJumpNext: { type: String as PropType, default: () => GlobalConfig.pager.iconJumpNext }, + iconNextPage: { type: String as PropType, default: () => GlobalConfig.pager.iconNextPage }, + iconJumpMore: { type: String as PropType, default: () => GlobalConfig.pager.iconJumpMore } }, emits: [ 'update:pageSize', diff --git a/packages/v-x-e-table/src/conf.ts b/packages/v-x-e-table/src/conf.ts index a95a2e449..0745ba62a 100644 --- a/packages/v-x-e-table/src/conf.ts +++ b/packages/v-x-e-table/src/conf.ts @@ -232,10 +232,10 @@ const GlobalConfig: VXETableGlobalConfig = { // size: null, // autoHidden: false, // perfect: true, - // pageSize: 10, - // pagerCount: 7, - // pageSizes: [10, 15, 20, 50, 100], - // layouts: ['PrevJump', 'PrevPage', 'Jump', 'PageCount', 'NextPage', 'NextJump', 'Sizes', 'Total'] + pageSize: 10, + pagerCount: 7, + pageSizes: [10, 15, 20, 50, 100], + layouts: ['PrevJump', 'PrevPage', 'Jump', 'PageCount', 'NextPage', 'NextJump', 'Sizes', 'Total'] }, form: { // preventSubmit: false, diff --git a/styles/pager.scss b/styles/pager.scss index 0c6c0023d..eed708abf 100644 --- a/styles/pager.scss +++ b/styles/pager.scss @@ -221,7 +221,7 @@ font-weight: 700; } } - .vxe-pager--sizes { + .vxe-select.size--mini.vxe-pager--sizes { width: 7em; text-align: center; cursor: pointer; -- Gitee From a966afb471e971a773c8cab3384abfc63fc3e9ea Mon Sep 17 00:00:00 2001 From: majinju Date: Tue, 9 Nov 2021 10:31:30 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/form.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/styles/form.scss b/styles/form.scss index 86030c525..4dd11486d 100644 --- a/styles/form.scss +++ b/styles/form.scss @@ -179,6 +179,7 @@ .vxe-form--item-content { position: relative; flex-grow: 1; + width: 100%; } } .vxe-default-input, -- Gitee From 43d67691ed3f73e6f769ac0b5678dc71de548243 Mon Sep 17 00:00:00 2001 From: majinju Date: Wed, 10 Nov 2021 12:55:36 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=96=B9=E6=B3=95=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=E5=BC=84=E4=B8=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/textarea/src/textarea.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/textarea/src/textarea.ts b/packages/textarea/src/textarea.ts index c003e7752..754d79574 100644 --- a/packages/textarea/src/textarea.ts +++ b/packages/textarea/src/textarea.ts @@ -22,7 +22,7 @@ export default defineComponent({ rows: { type: [String, Number] as PropType, default: () => GlobalConfig.textarea.rows }, cols: { type: [String, Number] as PropType, default: () => GlobalConfig.textarea.cols }, showWordCount: { type: Boolean as PropType, default: () => GlobalConfig.textarea.showWordCount }, - countMethod: { type: Function as PropType, default: () => GlobalConfig.textarea.countMethod }, + countMethod: { type: Function as PropType }, autosize: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.textarea.autosize }, form: { type: String as PropType, default: () => GlobalConfig.textarea.form }, resize: { type: String as PropType, default: () => GlobalConfig.textarea.resize }, -- Gitee From b6fbc0ecd06939a98c7bfbe827eafb434a0aacfc Mon Sep 17 00:00:00 2001 From: majinju Date: Wed, 10 Nov 2021 23:00:46 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E7=BB=99=E6=8C=89=E9=92=AE=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=82=B9=E5=87=BB=E5=9B=9E=E8=B0=83=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E4=BE=BF=E4=BA=8Ejson=E9=85=8D=E7=BD=AE=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=AE=BE=E7=BD=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/button/src/button.ts | 10 +++++++++- types/button.d.ts | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/button/src/button.ts b/packages/button/src/button.ts index a388a2317..5a99fec20 100644 --- a/packages/button/src/button.ts +++ b/packages/button/src/button.ts @@ -63,7 +63,11 @@ export default defineComponent({ /** * 是否将弹框容器插入于 body 内 */ - transfer: { type: Boolean as PropType, default: () => GlobalConfig.button.transfer } + transfer: { type: Boolean as PropType, default: () => GlobalConfig.button.transfer }, + /** + * 按钮点击回调方法 + */ + click: { type: Function as PropType } }, emits: [ 'click', @@ -199,6 +203,10 @@ export default defineComponent({ } const clickEvent = (evnt: Event) => { + if (props.click) { + // 回调按钮点击事件 + props.click({ $event: evnt }, evnt) + } buttonMethods.dispatchEvent('click', { $event: evnt }, evnt) } diff --git a/types/button.d.ts b/types/button.d.ts index 82502205f..155a73897 100644 --- a/types/button.d.ts +++ b/types/button.d.ts @@ -51,6 +51,7 @@ export namespace VxeButtonPropTypes { export type Loading = boolean; export type DestroyOnClose = boolean; export type Transfer = boolean; + export type Click = Function; } export type VxeButtonProps = { @@ -104,6 +105,10 @@ export type VxeButtonProps = { * 是否将弹框容器插入于 body 内 */ transfer?: VxeButtonPropTypes.Transfer; + /** + * 按钮点击回调方法 + */ + click?: VxeButtonPropTypes.Click; } export interface ButtonMethods { -- Gitee From 25155d52c8b9a496cc37be2ac5f3a90f4f12ccf3 Mon Sep 17 00:00:00 2001 From: majinju Date: Wed, 10 Nov 2021 23:54:07 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/button/src/button.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/button/src/button.ts b/packages/button/src/button.ts index 5a99fec20..981d3cd74 100644 --- a/packages/button/src/button.ts +++ b/packages/button/src/button.ts @@ -205,7 +205,7 @@ export default defineComponent({ const clickEvent = (evnt: Event) => { if (props.click) { // 回调按钮点击事件 - props.click({ $event: evnt }, evnt) + props.click({ $event: evnt, props: this.props }, evnt) } buttonMethods.dispatchEvent('click', { $event: evnt }, evnt) } -- Gitee