From c1ce6ec86abaac7f1af68ad786f54f4c8361dcd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Fri, 23 Nov 2018 17:26:32 +0800 Subject: [PATCH] use isUrl judgment icon --- src/components/SiderMenu/BaseMenu.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/SiderMenu/BaseMenu.js b/src/components/SiderMenu/BaseMenu.js index 8cf125ec..88ca0422 100644 --- a/src/components/SiderMenu/BaseMenu.js +++ b/src/components/SiderMenu/BaseMenu.js @@ -5,6 +5,7 @@ import isEqual from 'lodash/isEqual'; import memoizeOne from 'memoize-one'; import { urlToList } from '../_utils/pathTools'; import { getMenuMatches } from './SiderMenuUtils'; +import { isUrl } from '@/utils/utils'; import styles from './index.less'; const { SubMenu } = Menu; @@ -14,7 +15,7 @@ const { SubMenu } = Menu; // icon: 'http://demo.com/icon.png', // icon: , const getIcon = icon => { - if (typeof icon === 'string' && icon.indexOf('http') === 0) { + if (typeof icon === 'string' && isUrl(icon)) { return icon; } if (typeof icon === 'string') { -- GitLab