Add a website version selection.

pull/54/head
jaywcjlove 6 years ago
parent 5ff5213978
commit 7b64216728

@ -71,12 +71,21 @@ export default class App extends Component {
onKeyBoardMouseUp() {
this.setState({ keyStr: [] });
}
openVersionWebsite(e) {
if (e.target && e.target.value) {
window.location.href = e.target.value;
}
}
render() {
const { keyStr } = this.state;
let DocumentStrSource = DocumentStr;
if (DocumentStrSource) DocumentStrSource = DocumentStr.replace(/([\s\S]*)<!--dividing-->/, '');
return (
<div>
<select className={styles.version} onChange={this.openVersionWebsite.bind(this)}>
<option value="https://jaywcjlove.github.io/hotkeys">v3.0.0</option>
<option value="https://unpkg.com/hotkeys-js@2.0.10/doc/index.html">v2.0.10</option>
</select>
{keyStr.length > -1 && (
<div className={styles.keyCodeInfo}>
{keyStr.map(item => <span key={`${item}`}>{item}</span>)}

@ -1,3 +1,8 @@
.version {
position: absolute;
margin: 15px 0 0 15px;
}
.keyCodeInfo {
position: fixed;
bottom: 10px;

Loading…
Cancel
Save