Browse Source

兼容不支持 localstorage 的浏览器

pull/18425/head
天可 5 years ago
parent
commit
382882247b
  1. 6
      site/theme/template/IconDisplay/IconPicSearcher.tsx

6
site/theme/template/IconDisplay/IconPicSearcher.tsx

@ -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');
}
};
@ -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>

Loading…
Cancel
Save