refactor(components): [empty] (#11494)

This commit is contained in:
류한경 2023-02-11 20:11:22 +09:00 committed by GitHub
parent 9f76a5c11b
commit 87137f2391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 18 deletions

View File

@ -6,3 +6,4 @@ export const ElEmpty = withInstall(Empty)
export default ElEmpty
export * from './src/empty'
export type { EmptyInstance } from './src/instance'

View File

@ -1,7 +1,7 @@
import { buildProps } from '@element-plus/utils'
import type { ExtractPropTypes } from 'vue'
import type Empty from './empty.vue'
export const emptyProps = {
export const emptyProps = buildProps({
image: {
type: String,
default: '',
@ -11,7 +11,6 @@ export const emptyProps = {
type: String,
default: '',
},
} as const
export type EmptyProps = ExtractPropTypes<typeof emptyProps>
} as const)
export type EmptyInstance = InstanceType<typeof Empty>
export type EmptyProps = ExtractPropTypes<typeof emptyProps>

View File

@ -19,6 +19,7 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { useLocale, useNamespace } from '@element-plus/hooks'
import { addUnit } from '@element-plus/utils'
import ImgEmpty from './img-empty.vue'
import { emptyProps } from './empty'
@ -36,6 +37,6 @@ const emptyDescription = computed(
() => props.description || t('el.table.emptyText')
)
const imageStyle = computed<CSSProperties>(() => ({
width: props.imageSize ? `${props.imageSize}px` : '',
width: addUnit(props.imageSize),
}))
</script>

View File

@ -126,19 +126,13 @@
</svg>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { useNamespace } from '@element-plus/hooks'
<script lang="ts" setup>
import { useId, useNamespace } from '@element-plus/hooks'
let id = 0
export default defineComponent({
defineOptions({
name: 'ImgEmpty',
setup() {
const ns = useNamespace('empty')
return {
ns,
id: ++id,
}
},
})
const ns = useNamespace('empty')
const id = useId()
</script>

View File

@ -0,0 +1,3 @@
import type Empty from './empty.vue'
export type EmptyInstance = InstanceType<typeof Empty>