提交 b5046f07 编写于 作者: 无木

fix(form): fix some prop declaration

修复`submitButtonOptions`、'resetButtonOptions'的类型定义
上级 ddf116da
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
- 修复`ROLE`权限模式下`hasPermission`不工作的问题 - 修复`ROLE`权限模式下`hasPermission`不工作的问题
- **Table** 修复启用`clickToRowSelect`时,点击行不会触发`selection-change`事件的问题 - **Table** 修复启用`clickToRowSelect`时,点击行不会触发`selection-change`事件的问题
- **Table** 修复全局配置`fetchSetting`可能会被局部配置意外修改的问题 - **Table** 修复全局配置`fetchSetting`可能会被局部配置意外修改的问题
- **Form** 修复`submitButtonOptions``resetButtonOptions`的类型定义
## 2.5.2(2021-06-27) ## 2.5.2(2021-06-27)
......
import { withInstall } from '/@/utils'; import { withInstall } from '/@/utils';
import type { ExtractPropTypes } from 'vue';
import button from './src/BasicButton.vue'; import button from './src/BasicButton.vue';
import popConfirmButton from './src/PopConfirmButton.vue'; import popConfirmButton from './src/PopConfirmButton.vue';
import { buttonProps } from './src/props';
export const Button = withInstall(button); export const Button = withInstall(button);
export const PopConfirmButton = withInstall(popConfirmButton); export const PopConfirmButton = withInstall(popConfirmButton);
export declare type ButtonProps = Partial<ExtractPropTypes<typeof buttonProps>>;
...@@ -11,32 +11,13 @@ ...@@ -11,32 +11,13 @@
import { defineComponent, computed } from 'vue'; import { defineComponent, computed } from 'vue';
import { Button } from 'ant-design-vue'; import { Button } from 'ant-design-vue';
import { Icon } from '/@/components/Icon'; import { Icon } from '/@/components/Icon';
import { buttonProps } from './props';
const props = {
color: { type: String, validator: (v) => ['error', 'warning', 'success', ''].includes(v) },
loading: { type: Boolean },
disabled: { type: Boolean },
/**
* Text before icon.
*/
preIcon: { type: String },
/**
* Text after icon.
*/
postIcon: { type: String },
/**
* preIcon and postIcon icon size.
* @default: 14
*/
iconSize: { type: Number, default: 14 },
onClick: { type: Function as PropType<(...args) => any>, default: null },
};
export default defineComponent({ export default defineComponent({
name: 'AButton', name: 'AButton',
components: { Button, Icon }, components: { Button, Icon },
inheritAttrs: false, inheritAttrs: false,
props, props: buttonProps,
setup(props, { attrs }) { setup(props, { attrs }) {
// get component class // get component class
const getButtonClass = computed(() => { const getButtonClass = computed(() => {
......
export const buttonProps = {
color: { type: String, validator: (v) => ['error', 'warning', 'success', ''].includes(v) },
loading: { type: Boolean },
disabled: { type: Boolean },
/**
* Text before icon.
*/
preIcon: { type: String },
/**
* Text after icon.
*/
postIcon: { type: String },
/**
* preIcon and postIcon icon size.
* @default: 14
*/
iconSize: { type: Number, default: 14 },
onClick: { type: Function as PropType<(...args) => any>, default: null },
};
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import type { ColEx } from '../types/index'; import type { ColEx } from '../types/index';
import type { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'; //import type { ButtonProps } from 'ant-design-vue/es/button/buttonTypes';
import { defineComponent, computed, PropType } from 'vue'; import { defineComponent, computed, PropType } from 'vue';
import { Form, Col } from 'ant-design-vue'; import { Form, Col } from 'ant-design-vue';
import { Button } from '/@/components/Button'; import { Button, ButtonProps } from '/@/components/Button';
import { BasicArrow } from '/@/components/Basic/index'; import { BasicArrow } from '/@/components/Basic/index';
import { useFormContext } from '../hooks/useFormContext'; import { useFormContext } from '../hooks/useFormContext';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
......
import type { NamePath, RuleObject } from 'ant-design-vue/lib/form/interface'; import type { NamePath, RuleObject } from 'ant-design-vue/lib/form/interface';
import type { VNode } from 'vue'; import type { VNode } from 'vue';
import type { ButtonProps as AntdButtonProps } from 'ant-design-vue/es/button/buttonTypes'; import type { ButtonProps as AntdButtonProps } from '/@/components/Button';
import type { FormItem } from './formItem'; import type { FormItem } from './formItem';
import type { ColEx, ComponentType } from './index'; import type { ColEx, ComponentType } from './index';
import type { TableActionType } from '/@/components/Table/src/types/table'; import type { TableActionType } from '/@/components/Table/src/types/table';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册