Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
8768c69a
Commit
8768c69a
authored
Sep 06, 2017
by
nikogu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update searchinput
parent
02204c3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
31 deletions
+40
-31
src/components/SearchInput/index.js
src/components/SearchInput/index.js
+40
-10
src/components/SearchInput/index.less
src/components/SearchInput/index.less
+0
-21
No files found.
src/components/SearchInput/index.js
View file @
8768c69a
...
@@ -3,13 +3,43 @@ import { Button, Input } from 'antd';
...
@@ -3,13 +3,43 @@ import { Button, Input } from 'antd';
import
styles
from
'
./index.less
'
;
import
styles
from
'
./index.less
'
;
export
default
({
onSearch
=
()
=>
({}),
text
=
'
ζη΄’
'
,
...
reset
})
=>
(
export
default
class
SearchInput
extends
React
.
Component
{
<
div
className
=
{
styles
.
search
}
>
state
=
{
<
Input
value
:
this
.
props
.
defaultValue
,
placeholder
=
"
θ―·θΎε ₯
"
}
size
=
"
large
"
{...
reset
}
handleOnChange
=
(
e
)
=>
{
addonAfter
=
{
<
Button
onClick
=
{
onSearch
}
type
=
"
primary
"
>
{
text
}
<
/Button>
}
this
.
setState
({
/>
value
:
e
.
target
.
value
,
<
/div
>
});
);
}
handleOnSearch
=
()
=>
{
if
(
this
.
props
.
onSearch
)
{
this
.
props
.
onSearch
(
this
.
state
.
value
);
}
}
handleOnKey
=
(
e
)
=>
{
if
(
e
.
keyCode
===
13
)
{
this
.
handleOnSearch
();
}
}
render
()
{
const
{
text
=
'
ζη΄’
'
,
reset
}
=
this
.
props
;
return
(
<
div
className
=
{
styles
.
search
}
>
<
Input
onKeyDown
=
{
this
.
handleOnKey
}
placeholder
=
"
θ―·θΎε ₯
"
size
=
"
large
"
{...
reset
}
value
=
{
this
.
state
.
value
}
onChange
=
{
this
.
handleOnChange
}
addonAfter
=
{
<
Button
onClick
=
{
this
.
handleOnSearch
}
type
=
"
primary
"
>
{
text
}
<
/Button>
}
/>
<
/div
>
);
}
}
src/components/SearchInput/index.less
View file @
8768c69a
@import "~antd/lib/style/themes/default.less";
@import "~antd/lib/style/themes/default.less";
@import "../../utils/utils.less";
.search {
.search {
display: inline-block;
display: inline-block;
...
@@ -23,23 +22,3 @@
...
@@ -23,23 +22,3 @@
height: 40px;
height: 40px;
}
}
}
}
@media screen and (max-width: @screen-sm) {
.search {
:global {
.ant-input-group .ant-input {
width: 300px;
}
}
}
}
@media screen and (max-width: @screen-xs) {
.search {
:global {
.ant-input-group .ant-input {
width: 200px;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment