mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* refactor(components): [visual-hidden] visual-hidden * refactor(components): [visual-hidden] visual-hidden
35 lines
670 B
Vue
35 lines
670 B
Vue
<template>
|
|
<span v-bind="$attrs" :style="computedStyle">
|
|
<slot />
|
|
</span>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed } from 'vue'
|
|
import { visualHiddenProps } from './visual-hidden'
|
|
import type { StyleValue } from 'vue'
|
|
const props = defineProps(visualHiddenProps)
|
|
|
|
defineOptions({
|
|
name: 'ElVisuallyHidden',
|
|
})
|
|
|
|
const computedStyle = computed<StyleValue>(() => {
|
|
return [
|
|
props.style,
|
|
{
|
|
position: 'absolute',
|
|
border: 0,
|
|
width: 1,
|
|
height: 1,
|
|
padding: 0,
|
|
margin: -1,
|
|
overflow: 'hidden',
|
|
clip: 'rect(0, 0, 0, 0)',
|
|
whiteSpace: 'nowrap',
|
|
wordWrap: 'normal',
|
|
},
|
|
]
|
|
})
|
|
</script>
|