mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
refactor(components): [pagination/total] switch to script-setup syntax (#7750)
* refactor(components): [pagination/total] switch to script-setup syntax * fix(components): [pagination/total] cast props to const Co-authored-by: metanas <matanas@pre-history.com>
This commit is contained in:
parent
37ac01d025
commit
353b56e2c8
14
packages/components/pagination/src/components/total.ts
Normal file
14
packages/components/pagination/src/components/total.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { buildProps } from '@element-plus/utils'
|
||||||
|
import type Total from './total.vue'
|
||||||
|
import type { ExtractPropTypes } from 'vue'
|
||||||
|
|
||||||
|
export const paginationTotalProps = buildProps({
|
||||||
|
total: {
|
||||||
|
type: Number,
|
||||||
|
default: 1000,
|
||||||
|
},
|
||||||
|
} as const)
|
||||||
|
|
||||||
|
export type PaginationTotalProps = ExtractPropTypes<typeof paginationTotalProps>
|
||||||
|
|
||||||
|
export type TotalInstance = InstanceType<typeof Total>
|
@ -8,34 +8,18 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue'
|
|
||||||
import { useLocale, useNamespace } from '@element-plus/hooks'
|
import { useLocale, useNamespace } from '@element-plus/hooks'
|
||||||
import { usePagination } from '../usePagination'
|
import { usePagination } from '../usePagination'
|
||||||
import type { ExtractPropTypes } from 'vue'
|
import { paginationTotalProps } from './total'
|
||||||
|
|
||||||
const paginationTotalProps = {
|
|
||||||
total: {
|
|
||||||
type: Number,
|
|
||||||
default: 1000,
|
|
||||||
},
|
|
||||||
} as const
|
|
||||||
export type PaginationTotalProps = ExtractPropTypes<typeof paginationTotalProps>
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: 'ElPaginationTotal',
|
|
||||||
|
|
||||||
props: paginationTotalProps,
|
|
||||||
|
|
||||||
setup() {
|
|
||||||
const { t } = useLocale()
|
const { t } = useLocale()
|
||||||
const ns = useNamespace('pagination')
|
const ns = useNamespace('pagination')
|
||||||
const { disabled } = usePagination()
|
const { disabled } = usePagination()
|
||||||
return {
|
|
||||||
t,
|
defineOptions({
|
||||||
ns,
|
name: 'ElPaginationTotal',
|
||||||
disabled,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
defineProps(paginationTotalProps)
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user