diff --git a/package.json b/package.json
index df3e2be621..483442653c 100644
--- a/package.json
+++ b/package.json
@@ -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"
},
diff --git a/scripts/demo.js b/scripts/demo.js
index a672b20f46..5c13ff6465 100644
--- a/scripts/demo.js
+++ b/scripts/demo.js
@@ -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 ;
});
function onChange(e) {
if (versionsHistory[e.target.value]) {
- location.replace(versionsHistory[e.target.value]);
+ location.href = versionsHistory[e.target.value];
}
}
- React.render(, document.getElementById('versions-select'))
+ React.render(, document.getElementById('versions-select'));
});
module.exports = antd;