refactor: pagination to ts

feat-dayjs
Amour1688 2020-10-19 22:11:45 +08:00
parent 48f385556f
commit 6b8cebc25f
5 changed files with 17 additions and 14 deletions

View File

@ -1,7 +1,8 @@
import { defineComponent } from 'vue';
import VcSelect, { SelectProps } from '../select';
import { getOptionProps, getSlot } from '../_util/props-util';
export default {
export default defineComponent({
inheritAttrs: false,
props: {
...SelectProps(),
@ -16,4 +17,4 @@ export default {
};
return <VcSelect {...selelctProps}>{getSlot(this)}</VcSelect>;
},
};
});

View File

@ -1,3 +1,9 @@
import { defineComponent, inject } from 'vue';
import LeftOutlined from '@ant-design/icons-vue/LeftOutlined';
import RightOutlined from '@ant-design/icons-vue/RightOutlined';
import DoubleLeftOutlined from '@ant-design/icons-vue/DoubleLeftOutlined';
import DoubleRightOutlined from '@ant-design/icons-vue/DoubleRightOutlined';
import { tuple } from '../_util/type';
import PropTypes, { withUndefined } from '../_util/vue-types';
import VcSelect from '../select';
import MiniSelect from './MiniSelect';
@ -5,12 +11,7 @@ import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { getOptionProps } from '../_util/props-util';
import VcPagination from '../vc-pagination';
import enUS from '../vc-pagination/locale/en_US';
import LeftOutlined from '@ant-design/icons-vue/LeftOutlined';
import RightOutlined from '@ant-design/icons-vue/RightOutlined';
import DoubleLeftOutlined from '@ant-design/icons-vue/DoubleLeftOutlined';
import DoubleRightOutlined from '@ant-design/icons-vue/DoubleRightOutlined';
import { defaultConfigProvider } from '../config-provider';
import { inject } from 'vue';
import classNames from '../_util/classNames';
export const PaginationProps = () => ({
@ -39,10 +40,10 @@ export const PaginationProps = () => ({
export const PaginationConfig = () => ({
...PaginationProps(),
position: PropTypes.oneOf(['top', 'bottom', 'both']),
position: PropTypes.oneOf(tuple('top', 'bottom', 'both')),
});
export default {
export default defineComponent({
name: 'APagination',
inheritAttrs: false,
props: {
@ -56,7 +57,7 @@ export default {
},
methods: {
getIconsProps(prefixCls) {
getIconsProps(prefixCls: string) {
const prevIcon = (
<a class={`${prefixCls}-item-link`}>
<LeftOutlined />
@ -128,7 +129,7 @@ export default {
componentName="Pagination"
defaultLocale={enUS}
children={this.renderPagination}
></LocaleReceiver>
/>
);
},
};
});

View File

@ -1,9 +1,10 @@
import { App } from 'vue';
import Pagination from './Pagination';
export { PaginationProps, PaginationConfig } from './Pagination';
/* istanbul ignore next */
Pagination.install = function(app) {
Pagination.install = function(app: App) {
app.component(Pagination.name, Pagination);
return app;
};

View File

@ -3,7 +3,7 @@ import Option from './Option';
import OptGroup from './OptGroup';
import { BaseProps } from './generate';
export type SelectProps<T> = ExportedSelectProps<T>;
export type SelectProps<T = any> = ExportedSelectProps<T>;
export { Option, OptGroup, BaseProps };
export default Select;