浏览代码

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

zhangyumei.0319 2 年之前
父节点
当前提交
4a4a6a44c1
共有 1 个文件被更改,包括 2 次插入1 次删除
  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) {