小编Min*_*Kim的帖子

如何使 Antd 工具提示框悬停在其上方后消失?

我们正在使用 Ant Design 项目的工具提示。我们希望这些工具提示在悬停后消失。

import React, { useState } from 'react';
import styled from 'styled-components';
import { Tooltip } from 'antd';
import Highlighter from 'react-highlight-words';

const TooltipText = ({
  children,
  className,
  tabIndex,
  fontSize,
  padding,
  highlightWord,
  style = { 'white-space': 'nowrap' },
  toolTipPlacement = 'top',
  clickable = true,
  onClick,
}) => {
  const [truncated, setTruncated] = useState(false);
  const updateOverflow = e => {
    const el = e.currentTarget;
    if (el.classList.contains('detail-location')) {
      const canvasContext = document.createElement('canvas').getContext('2d');
      if (
        Math.ceil(canvasContext.measureText(el.innerText).width) >
        2 * el.clientWidth …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs antd

6
推荐指数
1
解决办法
7637
查看次数

标签 统计

antd ×1

javascript ×1

reactjs ×1