Skip to content

Commit

Permalink
兼容不支持 localstorage 的浏览器
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis617 committed Aug 23, 2019
1 parent 2d96dc4 commit 3828822
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions site/theme/template/IconDisplay/IconPicSearcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class PicSearcher extends Component<PicSearcherProps, PicSearcherState> {
fileList: [],
icons: [],
}));
if (!window.localStorage.getItem('disableIconTip')) {
window.localStorage.setItem('disableIconTip', 'true');
if (localStorage && !localStorage.getItem('disableIconTip')) {
localStorage.setItem('disableIconTip', 'true');
}
};

Expand All @@ -116,7 +116,7 @@ class PicSearcher extends Component<PicSearcherProps, PicSearcherState> {
<div className="icon-pic-searcher">
<Popover
content={messages[`app.docs.components.icon.pic-searcher.intro`]}
visible={!window.localStorage.getItem('disableIconTip')}
visible={!(localStorage && localStorage.getItem('disableIconTip'))}
>
<Icon type="camera" className="icon-pic-btn" onClick={this.toggleModal} />
</Popover>
Expand Down

0 comments on commit 3828822

Please sign in to comment.