mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
fix version select order
This commit is contained in:
parent
f26bbc1cd5
commit
6135242dc3
@ -89,6 +89,7 @@
|
||||
"precommit-hook": "^1.0.7",
|
||||
"react": "~0.13.0",
|
||||
"react-router": "1.0.0-rc1",
|
||||
"semver": "~5.0.3",
|
||||
"webpack": "^1.10.1",
|
||||
"webpack-dev-middleware": "^1.2.0"
|
||||
},
|
||||
|
@ -4,6 +4,7 @@ var antd = require('antd');
|
||||
|
||||
var $ = require('jquery');
|
||||
var React = require('react');
|
||||
var semver = require('semver');
|
||||
|
||||
InstantClickChangeFns.push(function () {
|
||||
// auto complete for components
|
||||
@ -54,18 +55,19 @@ InstantClickChangeFns.push(function () {
|
||||
};
|
||||
versionsHistory[antdVersion.latest] =
|
||||
versionsHistory[antdVersion.latest] || 'http://ant.design';
|
||||
var options = Object.keys(versionsHistory).map(function(version) {
|
||||
var versions = Object.keys(versionsHistory).sort(function(a, b) {
|
||||
return semver.lt(a, b);
|
||||
});
|
||||
var options = versions.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]);
|
||||
location.href = versionsHistory[e.target.value];
|
||||
}
|
||||
}
|
||||
React.render(<select defaultValue={antdVersion.latest} onChange={onChange}>
|
||||
{options}
|
||||
</select>, document.getElementById('versions-select'))
|
||||
React.render(<select defaultValue={antdVersion.latest} onChange={onChange}>{options}</select>, document.getElementById('versions-select'));
|
||||
});
|
||||
|
||||
module.exports = antd;
|
||||
|
Loading…
Reference in New Issue
Block a user