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

This commit is contained in:
bqy_fe 2022-03-22 17:48:58 +08:00 committed by GitHub
parent bb8609ecc6
commit 7218ee19a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,37 +16,26 @@
</div>
</template>
<script lang="ts">
import { computed, defineComponent } from 'vue'
<script lang="ts" setup>
import { computed } from 'vue'
import { useLocale, useNamespace } from '@element-plus/hooks'
import ImgEmpty from './img-empty.vue'
import { emptyProps } from './empty'
import type { CSSProperties } from 'vue'
export default defineComponent({
defineOptions({
name: 'ElEmpty',
components: {
ImgEmpty,
},
props: emptyProps,
setup(props) {
const { t } = useLocale()
const ns = useNamespace('empty')
const emptyDescription = computed(
() => props.description || t('el.table.emptyText')
)
const imageStyle = computed<CSSProperties>(() => ({
width: props.imageSize ? `${props.imageSize}px` : '',
}))
return {
ns,
emptyDescription,
imageStyle,
}
},
})
const props = defineProps(emptyProps)
const { t } = useLocale()
const ns = useNamespace('empty')
const emptyDescription = computed(
() => props.description || t('el.table.emptyText')
)
const imageStyle = computed<CSSProperties>(() => ({
width: props.imageSize ? `${props.imageSize}px` : '',
}))
</script>