diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index 177cd776cc5c10440309a23de2b2e77ea3e1d44e..deb5407942d37543c1d10f0424f1c4927560dcde 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -11,7 +11,7 @@ import React, { useState } from 'react'; import logo from '../assets/logo.svg'; import Authorized from '@/utils/Authorized'; import { formatMessage } from 'umi-plugin-react/locale'; -import { isAntDesignProOrDev } from '@/utils/utils'; +import { isAntDesignPro } from '@/utils/utils'; import { BasicLayout as ProLayoutComponents, BasicLayoutProps as ProLayoutComponentsProps, @@ -42,7 +42,7 @@ const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] => { }; const footerRender: BasicLayoutProps['footerRender'] = (_, defaultDom) => { - if (!isAntDesignProOrDev()) { + if (!isAntDesignPro()) { return defaultDom; } return ( @@ -51,7 +51,7 @@ const footerRender: BasicLayoutProps['footerRender'] = (_, defaultDom) => {
diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 480064c3318b66263e3e874ec5de1e48338b3e68..183dda9e7a22af928f1da73c07f59063564a50ea 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -5,14 +5,18 @@ export function isUrl(path: string) { return reg.test(path); } -// 给官方演示站点用,用于关闭真实开发环境不需要使用的特性 -export function isAntDesignProOrDev() { - const { NODE_ENV } = process.env; +export function isAntDesignPro() { if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { return true; } + return window.location.hostname === 'preview.pro.ant.design'; +} + +// 给官方演示站点用,用于关闭真实开发环境不需要使用的特性 +export function isAntDesignProOrDev() { + const { NODE_ENV } = process.env; if (NODE_ENV === 'development') { return true; } - return window.location.hostname === 'preview.pro.ant.design'; + return isAntDesignPro(); }