浏览代码

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>
xiaoMingTongXue 1 年之前
父节点
当前提交
141f3bdbd0

+ 1 - 0
src/components/Button/src/props.ts

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

+ 0 - 4
src/components/Form/src/BasicForm.vue

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

+ 4 - 6
src/components/Form/src/components/FormAction.vue

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

+ 2 - 1
src/components/Form/src/props.ts

@@ -2,10 +2,11 @@ import type { FieldMapToTime, FormSchema } from './types/form';
 import type { CSSProperties, PropType } from 'vue';
 import type { ColEx } from './types';
 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 { propTypes } from '@/utils/propTypes';
 
+import { ButtonProps } from '@/components/Button';
+
 export const basicProps = {
   model: {
     type: Object as PropType<Recordable>,

+ 1 - 2
src/components/SimpleMenu/src/components/SubMenuItem.vue

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