/* eslint-disable max-lines-per-function */ import React, { useState } from 'react'; import { Table, Dropdown, Tooltip, Tag, Popover } from '@douyinfe/semi-ui/'; import { IconCaretdown, IconUser } from '@douyinfe/semi-icons'; const CREATOR_MAP = { ALL: { value: 0, desc: '创建者', }, MINE: { value: 1, desc: '只看我的', }, }; function InTableDemo({}) { const [currentCreator, setCurrentCreator] = useState({}); const setCreator = type => { if (type) { setCurrentCreator(CREATOR_MAP[type] || {}); } }; const onDropdownVisibleChange = (...args) => console.log('Dropdown onVisibleChange: ', ...args); const onPopoverVisibleChange = (...args) => console.log('Popover onVisibleChange: ', ...args); const columns = [ { title: 'Name', dataIndex: 'name', width: 150, }, { title: 'Age', dataIndex: 'age', width: 150, }, { title: 'Address', dataIndex: 'address', }, { title: ( setCreator('ALL')}>创建者 setCreator('MINE')}>只看我的 )} > {'点击trigger'} ), key: 'creator', render: () => (
setCreator('ALL')}>创建者 setCreator('MINE')}>只看我的 )} > {currentCreator.desc} 123 )} >
), width: 168, }, { title: ( setCreator('ALL')}>创建者 setCreator('MINE')}>只看我的 )} > {'hover trigger'} ), key: 'hover-creator', render: () => (
setCreator('ALL')}>创建者 setCreator('MINE')}>只看我的 )} > {currentCreator.desc} 123 )} >
), width: 168, }, { render: (text, record) => ( Show Info ), width: 150, }, ]; const dataTotalSize = 43; const data = []; for (let i = 0; i < dataTotalSize; i++) { let age = 40 + i; let name = `Edward King ${i}`; data.push({ key: `${i}`, name, age, address: `London, Park Lane no. ${i} Lake Park`, description: `My name is ${name}, I am ${age} years old, living in New York No. ${i + 1} Lake Park.`, }); } return ; } export default InTableDemo;