• liji0565 · 大乘
    liji0565 · 大乘

    向问下,ant design pro v4 怎么去除全局页脚,我在BasicLayout.jsx 去除掉所有的footerRender,依然还是有页脚
    /**

    • Ant Design Pro v4 use @ant-design/pro-layout to handle Layout.
    • You can view component api by:
    • https://github.com/ant-design/ant-design-pro-layout */ import ProLayout, { SettingDrawer,DefaultFooter} from '@ant-design/pro-layout'; import React, { useEffect } from 'react'; import Link from 'umi/link'; import { connect } from 'dva'; import { formatMessage } from 'umi-plugin-react/locale'; import Authorized from '@/utils/Authorized'; import RightContent from '@/components/GlobalHeader/RightContent'; import { isAntDesignPro } from '@/utils/utils'; import logo from '../assets/logo.svg'; // import {DefaultFooter} from "@ant-design/pro-layout";

    /**

    • use Authorized check all menu item */

    const menuDataRender = menuList =>
    menuList.map(item => {
    const localItem = { ...item, children: item.children ? menuDataRender(item.children) : [] };
    return Authorized.check(item.authority, localItem, null);
    });

    const links = [
    {
    key: '',
    title: '',
    href: '',
    blankTarget: true,
    },
    {
    key: '',
    title: '',
    href: '',
    blankTarget: true,
    },
    ];

    const copyright = '';

    const footerRender = (_, defaultDom) => {
    if (!isAntDesignPro()) {
    // return defaultDom;
    return ( <>

    </>
    )
    }

    // return (
    // <>
    // {defaultDom}
    //
    //
    //
    //
    //
    // </>
    // );
    }
    const BasicLayout = props => {
    const { dispatch, children, settings } = props;
    /**

    • constructor */

    useEffect(() => {
    if (dispatch) {
    dispatch({
    type: 'user/fetchCurrent',
    });
    dispatch({
    type: 'settings/getSetting',
    });
    }
    }, []);
    /**

    • init variables */

    const handleMenuCollapse = payload => {
    if (dispatch) {
    dispatch({
    type: 'global/changeLayoutCollapsed',
    payload,
    });
    }
    };

    return (
    <>
    {
    if (menuItemProps.isUrl) {
    return defaultDom;
    }

          return <Link to={menuItemProps.path}>{defaultDom}</Link>;
        }}
        breadcrumbRender={(routers = []) => [
          {
            path: '/',
            breadcrumbName: formatMessage({
              id: 'menu.home',
              defaultMessage: 'Home',
            }),
          },
          ...routers,
        ]}
        itemRender={(route, params, routes, paths) => {
          const first = routes.indexOf(route) === 0;
          return first ? (
            <Link to={paths.join('/')}>{route.breadcrumbName}</Link>
          ) : (
            <span>{route.breadcrumbName}</span>
          );
        }}
        footerRender={footerRender}
        menuDataRender={menuDataRender}
        formatMessage={formatMessage}
        rightContentRender={rightProps => <RightContent {...rightProps} />}
        {...props}
        {...settings}
      >
        {children}
      </ProLayout>
      <SettingDrawer
        settings={settings}
        onSettingChange={config =>
          dispatch({
            type: 'settings/changeSetting',
            payload: config,
          })
        }
      />
    </>
    

    );
    };

    export default connect(({ global, settings }) => ({
    collapsed: global.collapsed,
    settings,
    }))(BasicLayout);

1 条回复

© 汕尾市求知科技有限公司 | 关注我们 | 在线学员:116

粤公网安备 44152102000088号 | 粤ICP备19038915号

Top