From 1c5f1cb7a6a0a9f619de4d3baa12059428edeeab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Sun, 29 Sep 2019 07:58:37 -0500 Subject: [PATCH] docs: Update demo (#19059) * docs: Update demo * fix lint --- .../select/demo/custom-dropdown-menu.md | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/components/select/demo/custom-dropdown-menu.md b/components/select/demo/custom-dropdown-menu.md index 8f713909f1..7d9313b1ab 100644 --- a/components/select/demo/custom-dropdown-menu.md +++ b/components/select/demo/custom-dropdown-menu.md @@ -14,7 +14,7 @@ title: Customize the dropdown menu via `dropdownRender`. ```jsx -import { Select, Divider } from 'antd'; +import { Select, Divider, Input } from 'antd'; import { Plus } from '@ant-design/icons'; const { Option } = Select; @@ -24,18 +24,26 @@ let index = 0; class App extends React.Component { state = { items: ['jack', 'lucy'], + name: '', + }; + + onNameChange = event => { + this.setState({ + name: event.target.value, + }); }; addItem = () => { console.log('addItem'); - const { items } = this.state; + const { items, name } = this.state; this.setState({ - items: [...items, `New item ${index++}`], + items: [...items, name || `New item ${index++}`], + name: '', }); }; render() { - const { items } = this.state; + const { items, name } = this.state; return ( + + Add item + + )} >