Quellcode durchsuchen

fix: [Anchor] The showTooltip API of Anchor supports object type

zhangyumei.0319 vor 2 Jahren
Ursprung
Commit
4a4a6a44c1
1 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen
  1. 2 1
      packages/semi-ui/anchor/link.tsx

+ 2 - 1
packages/semi-ui/anchor/link.tsx

@@ -6,6 +6,7 @@ import { cssClasses } from '@douyinfe/semi-foundation/anchor/constants';
 import LinkFoundation, { LinkAdapter } from '@douyinfe/semi-foundation/anchor/linkFoundation';
 import AnchorContext, { AnchorContextType } from './anchor-context';
 import Typography from '../typography/index';
+import { isObject } from 'lodash';
 
 const prefixCls = cssClasses.PREFIX;
 
@@ -101,7 +102,7 @@ export default class Link extends BaseComponent<LinkProps, {}> {
             [`${prefixCls}-link-tooltip-disabled`]: disabled,
         });
         if (showTooltip) {
-            const showTooltipObj = Object.prototype.toString.call(showTooltip) === '[object Object]' ? 
+            const showTooltipObj = isObject(showTooltip) ? 
                 Object.assign({ opts: {} }, showTooltip) : { opts: {} };
             // The position can be set through showTooltip, here it is compatible with the position API
             if (position) {