File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1- import { useState , useEffect } from 'react'
1+ import * as React from 'react'
22import { Switch , Link , Route , Redirect } from 'react-router-dom'
33import cx from 'classnames'
44import Menu from '../component/Menu'
@@ -13,6 +13,7 @@ import logo from '../crd.logo.svg'
1313import styles from './index.less'
1414import '../style/mobile.less'
1515
16+ const { useState, useEffect } = React
1617const SubMenu = Menu . SubMenu
1718
1819function BasicLayout ( {
@@ -31,18 +32,19 @@ function BasicLayout({
3132 useEffect ( ( ) => {
3233 if ( ifPrerender ) {
3334 scrollToTop ( )
34- // eslint-disable-next-line no-undef
3535 INJECT ?. inject ?. ( )
3636 }
3737 } , [ ] )
3838
3939 useEffect ( ( ) => {
40- // eslint-disable-next-line no-undef
4140 INJECT ?. injectWithPathname ?. ( pathname )
4241 } , [ pathname ] )
4342
4443 useEffect ( ( ) => {
45- const newPathName = location . pathname
44+ const { pathname } = location
45+ const newPathName = pathname . endsWith ( '/' )
46+ ? pathname . slice ( 0 , pathname . length - 1 )
47+ : pathname
4648 setSelectedKey ( newPathName )
4749 } , location )
4850
You can’t perform that action at this time.
0 commit comments