Skip to content

Commit

Permalink
fix(element): add optinal chain to FormItem useOverflow hook (#2519)
Browse files Browse the repository at this point in the history
container may not contain a label element which leads to an error
  • Loading branch information
qq1037305420 authored Nov 26, 2021
1 parent 725fcdf commit da18983
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/element/src/form-item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const useOverflow = (containerRef: Ref<HTMLElement>) => {
const container = containerRef.value
const content = container.querySelector('label')
const containerWidth = container.getBoundingClientRect().width
const contentWidth = content.getBoundingClientRect().width
const contentWidth = content?.getBoundingClientRect().width

if (containerWidth !== 0) {
if (contentWidth > containerWidth) {
Expand Down

0 comments on commit da18983

Please sign in to comment.