From 56fff6aa8037bba73cd60cc7355ee44d92bd373b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 3 Jun 2019 18:41:38 +0800 Subject: [PATCH] edit style --- src/layouts/BasicLayout.tsx | 6 +++--- src/utils/utils.ts | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index 177cd776..deb54079 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 480064c3..183dda9e 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(); } -- GitLab