File tree 1 file changed +6
-4
lines changed
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'
2
2
import { Switch , Link , Route , Redirect } from 'react-router-dom'
3
3
import cx from 'classnames'
4
4
import Menu from '../component/Menu'
@@ -13,6 +13,7 @@ import logo from '../crd.logo.svg'
13
13
import styles from './index.less'
14
14
import '../style/mobile.less'
15
15
16
+ const { useState, useEffect } = React
16
17
const SubMenu = Menu . SubMenu
17
18
18
19
function BasicLayout ( {
@@ -31,18 +32,19 @@ function BasicLayout({
31
32
useEffect ( ( ) => {
32
33
if ( ifPrerender ) {
33
34
scrollToTop ( )
34
- // eslint-disable-next-line no-undef
35
35
INJECT ?. inject ?. ( )
36
36
}
37
37
} , [ ] )
38
38
39
39
useEffect ( ( ) => {
40
- // eslint-disable-next-line no-undef
41
40
INJECT ?. injectWithPathname ?. ( pathname )
42
41
} , [ pathname ] )
43
42
44
43
useEffect ( ( ) => {
45
- const newPathName = location . pathname
44
+ const { pathname } = location
45
+ const newPathName = pathname . endsWith ( '/' )
46
+ ? pathname . slice ( 0 , pathname . length - 1 )
47
+ : pathname
46
48
setSelectedKey ( newPathName )
47
49
} , location )
48
50
You can’t perform that action at this time.
0 commit comments