mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-17 13:01:46 +08:00
refactor(components): [visual-hidden] visual-hidden (#8192)
* refactor(components): [visual-hidden] visual-hidden * refactor(components): [visual-hidden] visual-hidden
This commit is contained in:
@ -4,36 +4,31 @@
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent } from 'vue'
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { visualHiddenProps } from './visual-hidden'
|
||||
import type { StyleValue } from 'vue'
|
||||
const props = defineProps(visualHiddenProps)
|
||||
|
||||
export default defineComponent({
|
||||
defineOptions({
|
||||
name: 'ElVisuallyHidden',
|
||||
props: {
|
||||
style: {
|
||||
type: [String, Object, Array],
|
||||
})
|
||||
|
||||
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',
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
return {
|
||||
computedStyle: computed(() => {
|
||||
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',
|
||||
},
|
||||
] as any
|
||||
}),
|
||||
}
|
||||
},
|
||||
]
|
||||
})
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user