fix Cannot read property 'addEventListener' of null #946

This commit is contained in:
Baorong Li
2019-03-05 16:15:02 +08:00
parent 76e5359752
commit 29aa0f416e
+5 -6
View File
@@ -59,19 +59,18 @@ class PrimaryLayout extends PureComponent {
// Localized route name.
const lang = langFromPath(location.pathname);
const lang = langFromPath(location.pathname)
const newRouteList =
lang !== 'en'
lang !== 'en'
? routeList.map(item => {
const { name , ...other } = item
const { name, ...other } = item
return {
...other,
name: ((item[lang] || {}).name || name),
name: (item[lang] || {}).name || name,
}
})
: routeList
// Find a route that matches the pathname.
const currentRoute = newRouteList.find(
_ => _.route && pathMatchRegexp(_.route, location.pathname)
@@ -148,7 +147,7 @@ class PrimaryLayout extends PureComponent {
</Content>
<BackTop
className={styles.backTop}
target={() => document.querySelector('#primaryLayout>div')}
target={() => document.querySelector('#primaryLayout')}
/>
<GlobalFooter
className={styles.footer}