fix: 修复表单按钮的类型定义外部无法修改重置或者提交按钮的文字的问题

* 解决 eslint-plugin-vue 关于 v-show 无法在 template 中报错的问题

* fix: 修复表单按钮的类型定义外部无法修改重置或者提交按钮的文字的问题

* chore: remove type ButtonOptions

---------

Co-authored-by: chengmingrui <chengmingrui@oneaiops.com>
Co-authored-by: likui628 <90845831+likui628@users.noreply.github.com>
This commit is contained in:
xiaoMingTongXue 2023-12-26 17:56:13 +08:00 committed by GitHub
parent cc97f06354
commit 141f3bdbd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 13 deletions

View File

@ -23,4 +23,5 @@ export const buttonProps = {
*/ */
iconSize: { type: Number, default: 14 }, iconSize: { type: Number, default: 14 },
onClick: { type: [Function, Array] as PropType<(() => any) | (() => any)[]>, default: null }, onClick: { type: [Function, Array] as PropType<(() => any) | (() => any)[]>, default: null },
text: { type: String },
}; };

View File

@ -342,10 +342,6 @@
display: flex; display: flex;
} }
.ant-form-item-control {
// margin-top: 4px;
}
.suffix { .suffix {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;

View File

@ -49,8 +49,6 @@
import { useI18n } from '@/hooks/web/useI18n'; import { useI18n } from '@/hooks/web/useI18n';
import { propTypes } from '@/utils/propTypes'; import { propTypes } from '@/utils/propTypes';
type ButtonOptions = Partial<ButtonProps> & { text: string };
defineOptions({ name: 'BasicFormAction' }); defineOptions({ name: 'BasicFormAction' });
const props = defineProps({ const props = defineProps({
@ -59,11 +57,11 @@
showSubmitButton: propTypes.bool.def(true), showSubmitButton: propTypes.bool.def(true),
showAdvancedButton: propTypes.bool.def(true), showAdvancedButton: propTypes.bool.def(true),
resetButtonOptions: { resetButtonOptions: {
type: Object as PropType<ButtonOptions>, type: Object as PropType<ButtonProps>,
default: () => ({}), default: () => ({}),
}, },
submitButtonOptions: { submitButtonOptions: {
type: Object as PropType<ButtonOptions>, type: Object as PropType<ButtonProps>,
default: () => ({}), default: () => ({}),
}, },
actionColOptions: { actionColOptions: {
@ -93,7 +91,7 @@
return actionColOpt; return actionColOpt;
}); });
const getResetBtnOptions = computed((): ButtonOptions => { const getResetBtnOptions = computed((): ButtonProps => {
return Object.assign( return Object.assign(
{ {
text: t('common.resetText'), text: t('common.resetText'),
@ -102,7 +100,7 @@
); );
}); });
const getSubmitBtnOptions = computed(() => { const getSubmitBtnOptions = computed((): ButtonProps => {
return Object.assign( return Object.assign(
{ {
text: t('common.queryText'), text: t('common.queryText'),

View File

@ -2,10 +2,11 @@ import type { FieldMapToTime, FormSchema } from './types/form';
import type { CSSProperties, PropType } from 'vue'; import type { CSSProperties, PropType } from 'vue';
import type { ColEx } from './types'; import type { ColEx } from './types';
import type { TableActionType } from '@/components/Table'; import type { TableActionType } from '@/components/Table';
import type { ButtonProps } from 'ant-design-vue/es/button/buttonTypes';
import type { RowProps } from 'ant-design-vue/lib/grid/Row'; import type { RowProps } from 'ant-design-vue/lib/grid/Row';
import { propTypes } from '@/utils/propTypes'; import { propTypes } from '@/utils/propTypes';
import { ButtonProps } from '@/components/Button';
export const basicProps = { export const basicProps = {
model: { model: {
type: Object as PropType<Recordable>, type: Object as PropType<Recordable>,

View File

@ -44,8 +44,7 @@
:class="`${prefixCls}-submenu-title-icon`" :class="`${prefixCls}-submenu-title-icon`"
/> />
</div> </div>
<!-- eslint-disable-next-line --> <template #content v-if="state.opened">
<template #content v-show="state.opened">
<div v-bind="getEvents(true)"> <div v-bind="getEvents(true)">
<ul :class="[prefixCls, `${prefixCls}-${getTheme}`, `${prefixCls}-popup`]"> <ul :class="[prefixCls, `${prefixCls}-${getTheme}`, `${prefixCls}-popup`]">
<slot></slot> <slot></slot>