Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· OpenAIAi2 WildChat-4.8M (AI2)

Untitled conversation

  1. User

    { title: , dataIndex: 'readBytes', render: (dom, entity) => ( <div style={{ display: 'flex', flexWrap: 'nowrap' }}> {entity.readBytes!.map((item) => ( <svg style={{ display: 'inline-block', width: '5px', height: '5px', marginRight: '2px' }} > ))} ), }, как к каждому svg прикрепить tooltip?

  2. Assistant

    Можно использовать компонент Tooltip из библиотеки antd и обернуть каждый svg в этот компонент, передав нужный текст в свойство title. Примерно так:

    import { Tooltip } from 'antd';
    
    ...
    
    {entity.readBytes!.map((item, index) => (
      <Tooltip title={`Tooltip text ${index}`}>
        <svg style={{ display: 'inline-block', width: '5px', height: '5px', marginRight: '2px' }}>
          <circle cx="2.5" cy="2.5" r="2.5" stroke="#888" strokeWidth="1" fill="#1890ff" />
        </svg>
      </Tooltip>
    ))}
    

    Таким образом, каждый svg будет обернут в компонент Tooltip с нужным текстом, который будет появляться при наведении на элемент.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.