refactor: pagination to ts
parent
48f385556f
commit
6b8cebc25f
|
@ -1,7 +1,8 @@
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
import VcSelect, { SelectProps } from '../select';
|
import VcSelect, { SelectProps } from '../select';
|
||||||
import { getOptionProps, getSlot } from '../_util/props-util';
|
import { getOptionProps, getSlot } from '../_util/props-util';
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
props: {
|
props: {
|
||||||
...SelectProps(),
|
...SelectProps(),
|
||||||
|
@ -16,4 +17,4 @@ export default {
|
||||||
};
|
};
|
||||||
return <VcSelect {...selelctProps}>{getSlot(this)}</VcSelect>;
|
return <VcSelect {...selelctProps}>{getSlot(this)}</VcSelect>;
|
||||||
},
|
},
|
||||||
};
|
});
|
|
@ -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 PropTypes, { withUndefined } from '../_util/vue-types';
|
||||||
import VcSelect from '../select';
|
import VcSelect from '../select';
|
||||||
import MiniSelect from './MiniSelect';
|
import MiniSelect from './MiniSelect';
|
||||||
|
@ -5,12 +11,7 @@ import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
||||||
import { getOptionProps } from '../_util/props-util';
|
import { getOptionProps } from '../_util/props-util';
|
||||||
import VcPagination from '../vc-pagination';
|
import VcPagination from '../vc-pagination';
|
||||||
import enUS from '../vc-pagination/locale/en_US';
|
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 { defaultConfigProvider } from '../config-provider';
|
||||||
import { inject } from 'vue';
|
|
||||||
import classNames from '../_util/classNames';
|
import classNames from '../_util/classNames';
|
||||||
|
|
||||||
export const PaginationProps = () => ({
|
export const PaginationProps = () => ({
|
||||||
|
@ -39,10 +40,10 @@ export const PaginationProps = () => ({
|
||||||
|
|
||||||
export const PaginationConfig = () => ({
|
export const PaginationConfig = () => ({
|
||||||
...PaginationProps(),
|
...PaginationProps(),
|
||||||
position: PropTypes.oneOf(['top', 'bottom', 'both']),
|
position: PropTypes.oneOf(tuple('top', 'bottom', 'both')),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: 'APagination',
|
name: 'APagination',
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
props: {
|
props: {
|
||||||
|
@ -56,7 +57,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getIconsProps(prefixCls) {
|
getIconsProps(prefixCls: string) {
|
||||||
const prevIcon = (
|
const prevIcon = (
|
||||||
<a class={`${prefixCls}-item-link`}>
|
<a class={`${prefixCls}-item-link`}>
|
||||||
<LeftOutlined />
|
<LeftOutlined />
|
||||||
|
@ -128,7 +129,7 @@ export default {
|
||||||
componentName="Pagination"
|
componentName="Pagination"
|
||||||
defaultLocale={enUS}
|
defaultLocale={enUS}
|
||||||
children={this.renderPagination}
|
children={this.renderPagination}
|
||||||
></LocaleReceiver>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
});
|
|
@ -1,9 +1,10 @@
|
||||||
|
import { App } from 'vue';
|
||||||
import Pagination from './Pagination';
|
import Pagination from './Pagination';
|
||||||
|
|
||||||
export { PaginationProps, PaginationConfig } from './Pagination';
|
export { PaginationProps, PaginationConfig } from './Pagination';
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
Pagination.install = function(app) {
|
Pagination.install = function(app: App) {
|
||||||
app.component(Pagination.name, Pagination);
|
app.component(Pagination.name, Pagination);
|
||||||
return app;
|
return app;
|
||||||
};
|
};
|
|
@ -3,7 +3,7 @@ import Option from './Option';
|
||||||
import OptGroup from './OptGroup';
|
import OptGroup from './OptGroup';
|
||||||
import { BaseProps } from './generate';
|
import { BaseProps } from './generate';
|
||||||
|
|
||||||
export type SelectProps<T> = ExportedSelectProps<T>;
|
export type SelectProps<T = any> = ExportedSelectProps<T>;
|
||||||
export { Option, OptGroup, BaseProps };
|
export { Option, OptGroup, BaseProps };
|
||||||
|
|
||||||
export default Select;
|
export default Select;
|
||||||
|
|
Loading…
Reference in New Issue