mirror of https://gitee.com/cf-fz/WebCAD.git
parent
07234645fb
commit
a875eb6bc7
@ -0,0 +1,33 @@
|
||||
import * as React from "React";
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import { commandStore, CommandStore } from '../Store/CommandStore';
|
||||
|
||||
|
||||
@inject("commandStore") @observer
|
||||
export class CommandLineInput extends React.Component<{ commandStore?: CommandStore }, {}>
|
||||
{
|
||||
render()
|
||||
{
|
||||
const commandStore = this.props.commandStore;
|
||||
return (
|
||||
<div className='terminal-input'>
|
||||
<input type="text" id="command-input"
|
||||
ref={o => { commandStore.elInput = o; }}
|
||||
onKeyDown={this.onInputKeyDown}
|
||||
onChange={this.onInputChange}
|
||||
placeholder="请输入命令:"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
onInputChange = (e: React.FormEvent<HTMLInputElement>) =>
|
||||
{
|
||||
if (e.currentTarget.value == " ") {
|
||||
e.currentTarget.value = ""
|
||||
}
|
||||
}
|
||||
onInputKeyDown = (e: React.KeyboardEvent<object>) =>
|
||||
{
|
||||
this.props.commandStore.keyDownHandle(e.keyCode);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue