diff --git a/src/dropdown/Dropdown.tsx b/src/dropdown/Dropdown.tsx index e5804da67..06bbe046a 100644 --- a/src/dropdown/Dropdown.tsx +++ b/src/dropdown/Dropdown.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { isValidElement, useState } from 'react'; import classNames from 'classnames'; import omit from 'lodash/omit'; import { DropdownOption, TdDropdownProps } from './type'; @@ -66,6 +66,9 @@ const Dropdown: React.FC & { overlayInnerStyle: style, }; + const child = arrayChildren?.[0]; + const dropDownTrigger = isValidElement(child) ? React.cloneElement(child as React.ReactElement, { disabled }) : child; + return ( & { onVisibleChange={handleVisibleChange} {...popupParams} > - {arrayChildren?.[0]} + {dropDownTrigger} ); };