refactor(components): [visual-hidden] visual-hidden (#8192)

* refactor(components): [visual-hidden] visual-hidden

* refactor(components): [visual-hidden] visual-hidden
This commit is contained in:
gjfei
2022-06-15 21:51:15 +08:00
committed by GitHub
parent 73cb5508fb
commit 7cb0b45d42
3 changed files with 34 additions and 28 deletions

View File

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