use antd select

This commit is contained in:
afc163 2015-11-03 17:35:35 +08:00
parent 556ec6068c
commit 4cddeeea56
2 changed files with 15 additions and 6 deletions

View File

@ -52,6 +52,8 @@ InstantClickChangeFns.push(function () {
});
InstantClickChangeFns.push(function () {
var Select = antd.Select;
var Option = Select.Option;
var versionsHistory = {
'0.9.2': '09x.ant.design'
};
@ -62,17 +64,19 @@ InstantClickChangeFns.push(function () {
});
var options = versions.map(function (version) {
var link = versionsHistory[version];
return <option key={version} value={version}>{version}</option>;
return <Option key={version} value={version}>{version}</Option>;
});
function onChange(e) {
if (versionsHistory[e.target.value]) {
location.href = location.href.replace(location.host, versionsHistory[e.target.value]);
function onChange(value) {
if (versionsHistory[value]) {
location.href = location.href.replace(location.host, versionsHistory[value]);
}
}
ReactDOM.render(<select defaultValue={antdVersion.latest}
onChange={onChange}>{options}</select>, document.getElementById('versions-select'));
ReactDOM.render(
<Select defaultValue={antdVersion.latest} size="small" style={{width:130}}
onChange={onChange}>{options}</Select>
, document.getElementById('versions-select'));
});
module.exports = antd;

View File

@ -1996,3 +1996,8 @@ a.entry-link:hover .anticon-smile {
#instantclick-bar {
background: #6EB4E0;
}
#versions-select {
position: relative;
top: -2px;
}