Add document version switch in footer, #406

This commit is contained in:
afc163 2015-10-19 17:57:33 +08:00
parent a2b07e2a3b
commit f26bbc1cd5
3 changed files with 22 additions and 1 deletions

View File

@ -39,7 +39,7 @@ React.render(
````
````css
.ant-select{
.code-box-demo .ant-select {
margin: 0 10px 10px 0;
}
````

View File

@ -48,4 +48,24 @@ InstantClickChangeFns.push(function () {
React.render(<AutoComplete/>, document.getElementById('autoComplete'));
});
InstantClickChangeFns.push(function () {
var versionsHistory = {
'0.9.1': 'http://09x.ant.design'
};
versionsHistory[antdVersion.latest] =
versionsHistory[antdVersion.latest] || 'http://ant.design';
var options = Object.keys(versionsHistory).map(function(version) {
var link = versionsHistory[version];
return <option value={version}>{version}</option>;
});
function onChange(e) {
if (versionsHistory[e.target.value]) {
location.replace(versionsHistory[e.target.value]);
}
}
React.render(<select defaultValue={antdVersion.latest} onChange={onChange}>
{options}
</select>, document.getElementById('versions-select'))
});
module.exports = antd;

View File

@ -16,6 +16,7 @@
</li>
<li>
<h3>©2015 蚂蚁金服体验技术部出品</h3>
<h3>文档版本:<span id="versions-select"></span></h3>
</li>
</ul>
</footer>