UNPKG

@antdp/layout-tabs

Version:

用于主框架选项卡组件。

47 lines 1.25 kB
import React, { useMemo } from 'react'; import Frame, { FrameContextConsumer } from 'react-frame-component'; // @ts-ignore import { history } from '@umijs/max'; import { useLocation } from 'react-router-dom'; import { jsx as _jsx } from "react/jsx-runtime"; export default props => { var { isShowView = false, bodyPadding = '', match = '', child: Child } = props; var location = useLocation(); var child = useMemo(() => /*#__PURE__*/_jsx(Child, { match: match, history: history, location: location }), [location.pathname]); return useMemo(() => { return /*#__PURE__*/_jsx(Frame // onLoad={() => { // console.log('~~::::') // }} , { mountTarget: "#mount-antdp" // initialContent={initialContent()} , className: "antdps-global-frame", style: { display: isShowView ? 'block' : 'none', height: 'calc(100% - 35px)' }, children: /*#__PURE__*/_jsx(FrameContextConsumer, { children: _ref => { var {} = _ref; return /*#__PURE__*/_jsx("div", { style: { padding: bodyPadding || 14 }, children: child }); } }) }); }, [isShowView]); };