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:
Anas Boudih 2022-05-19 02:18:39 +01:00 committed by GitHub
parent 37ac01d025
commit 353b56e2c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 24 deletions

View 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>

View File

@ -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>