import { ExclamationCircleOutlined, TagOutlined } from '@ant-design/icons'; import { List, Modal, Typography, Popconfirm, Row, Col, Popover, Button } from 'antd'; import { usePageInfoVersionList } from 'editorSrc/api/pageInfoVersionList'; import React, { useEffect } from 'react'; import styled from 'styled-components'; import { history } from 'umi'; interface IVersionListProps {} const VersionList: React.FC = (props) => { const { data } = usePageInfoVersionList(); useEffect(() => { /** * 修改URL参数,跳转版本后,被加入history,导致goback 无法回到装饰首页 * 监听 goback ,直接跳回装饰首页 */ window.onpopstate = function (event) { // alert(); const from = history.location.query?.from as string; if (from) { history.push(from); } }; }, []); const content = ( { const id = item?._id.slice(13) return ( {id} {`${item?.created_at}`} { history.push({ pathname: history.location.pathname, query: { ...history.location.query, cacheVersion: item._id, }, }); }} > 还原到该版本 ); }} /> ); return ( ); }; const Box = styled.div` /* padding: 0 32px; */ height: 200px; width: 380px; overflow-y: scroll; `; export default VersionList;