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
41a1798a
Commit
41a1798a
authored
Sep 30, 2018
by
陈帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new TagSelect demo
parent
fab29f3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
src/components/TagSelect/demo/controlled.md
src/components/TagSelect/demo/controlled.md
+50
-0
No files found.
src/components/TagSelect/demo/controlled.md
0 → 100644
View file @
41a1798a
---
order
:
3
title
:
受控模式
---
结合
`Tag`
的
`TagSelect`
组件,方便的应用于筛选类目的业务场景中。
```
jsx
import
{
Button
}
from
'
antd
'
;
import
TagSelect
from
'
ant-design-pro/lib/TagSelect
'
;
class
Demo
extends
React
.
Component
{
state
=
{
value
:
[
'
cat1
'
],
};
handleFormSubmit
=
value
=>
{
this
.
setState
({
value
,
});
};
checkAll
=
()
=>
{
this
.
setState
({
value
:
[
'
cat1
'
,
'
cat2
'
,
'
cat3
'
,
'
cat4
'
,
'
cat5
'
,
'
cat6
'
],
});
};
render
()
{
return
(
<
div
>
<
Button
onClick
=
{
this
.
checkAll
}
>
全部
</
Button
>
<
div
style
=
{
{
padding
:
16
,
}
}
>
<
TagSelect
hideCheckAll
=
{
true
}
value
=
{
this
.
state
.
value
}
onChange
=
{
this
.
handleFormSubmit
}
>
<
TagSelect
.
Option
value
=
"cat1"
>
类目一
</
TagSelect
.
Option
>
<
TagSelect
.
Option
value
=
"cat2"
>
类目二
</
TagSelect
.
Option
>
<
TagSelect
.
Option
value
=
"cat3"
>
类目三
</
TagSelect
.
Option
>
<
TagSelect
.
Option
value
=
"cat4"
>
类目四
</
TagSelect
.
Option
>
<
TagSelect
.
Option
value
=
"cat5"
>
类目五
</
TagSelect
.
Option
>
<
TagSelect
.
Option
value
=
"cat6"
>
类目六
</
TagSelect
.
Option
>
</
TagSelect
>
</
div
>
</
div
>
);
}
}
ReactDOM
.
render
(<
Demo
/>,
mountNode
);
```
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