mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
Tabs 的 Search 按 enter 提交表达关闭
Change-Id: I810450dbe045c1304fb24a028ec0058178453c21
This commit is contained in:
parent
b06d5524e3
commit
d706413ec0
@ -74,7 +74,7 @@ export class SearchBox extends React.Component<SearchBoxProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
handleKeyUp(e: React.KeyboardEvent<any>) {
|
handleKeyDown(e: React.KeyboardEvent<any>) {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
this.handleSearch();
|
this.handleSearch();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -110,7 +110,7 @@ export class SearchBox extends React.Component<SearchBoxProps> {
|
|||||||
placeholder={__(placeholder || '输入关键字')}
|
placeholder={__(placeholder || '输入关键字')}
|
||||||
ref={this.inputRef}
|
ref={this.inputRef}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
onKeyUp={this.handleKeyUp}
|
onKeyDown={this.handleKeyDown}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{!mini ? (
|
{!mini ? (
|
||||||
|
@ -129,6 +129,13 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
|
|||||||
onChange && onChange([]);
|
onChange && onChange([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@autobind
|
||||||
|
handleSearchKeyDown(e: React.KeyboardEvent<any>) {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
handleSearch(text: string) {
|
handleSearch(text: string) {
|
||||||
// text 有值的时候,走搜索否则直接走 handleSeachCancel ,等同于右侧的 clear 按钮
|
// text 有值的时候,走搜索否则直接走 handleSeachCancel ,等同于右侧的 clear 按钮
|
||||||
@ -243,6 +250,7 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
|
|||||||
onChange={this.handleSearch}
|
onChange={this.handleSearch}
|
||||||
placeholder={__('请输入关键字')}
|
placeholder={__('请输入关键字')}
|
||||||
clearable={false}
|
clearable={false}
|
||||||
|
onKeyDown={this.handleSearchKeyDown}
|
||||||
>
|
>
|
||||||
{this.state.searchResult !== null ? (
|
{this.state.searchResult !== null ? (
|
||||||
<a onClick={this.handleSeachCancel}>
|
<a onClick={this.handleSeachCancel}>
|
||||||
|
Loading…
Reference in New Issue
Block a user