import React from 'react'; import { FormattedMessage } from 'react-intl'; import { Select, Modal } from 'antd'; import { version as antdVersion } from 'antd/package.json'; import { docVersions } from '../../'; const Option = Select.Option; function isLocalStorageNameSupported() { const testKey = 'test'; const storage = window.localStorage; try { storage.setItem(testKey, '1'); storage.removeItem(testKey); return true; } catch (error) { return false; } } docVersions[antdVersion] = antdVersion; export default class Footer extends React.Component { componentDidMount() { // for some iOS // http://stackoverflow.com/a/14555361 if (!isLocalStorageNameSupported()) { return; } // 大版本发布后全局弹窗提示 // 1. 点击『知道了』之后不再提示 // 2. 超过截止日期后不再提示 if (localStorage.getItem('infoNewVersionSent') !== 'true' && new Date().getTime() < new Date('2016/05/22').getTime()) { this.infoNewVersion(); } } infoNewVersion() { Modal.info({ title: 'antd 新版发布!', content: (
Ant Design

您好,antd@1.0 已正式发布,欢迎升级。 如果您还需要使用旧版,请查阅 012x.ant.design ,也可通过页面右下角的文档版本选择框进行切换。

), onOk: () => localStorage.setItem('infoNewVersionSent', 'true'), className: 'new-version-info-modal', width: 470, }); } handleVersionChange = (url) => { window.location.href = url; } render() { const options = Object.keys(docVersions).map(version => ( )); return ( ); } }