mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-04 20:27:44 +08:00
refactor(components): [form-label-wrap] use getStyle method (#13913)
This commit is contained in:
parent
ec639c4d14
commit
c6a6d9bc6e
@ -11,7 +11,7 @@ import {
|
||||
watch,
|
||||
} from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { throwError } from '@element-plus/utils'
|
||||
import { getStyle, throwError } from '@element-plus/utils'
|
||||
import { useNamespace } from '@element-plus/hooks'
|
||||
import { formContextKey, formItemContextKey } from './constants'
|
||||
|
||||
@ -41,8 +41,11 @@ export default defineComponent({
|
||||
|
||||
const getLabelWidth = () => {
|
||||
if (el.value?.firstElementChild) {
|
||||
const width = window.getComputedStyle(el.value.firstElementChild).width
|
||||
return Math.ceil(Number.parseFloat(width))
|
||||
const width = getStyle(
|
||||
el.value.firstElementChild as HTMLElement,
|
||||
'width'
|
||||
)
|
||||
return Math.ceil(Number.parseFloat(width)) || 0
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user