From 3ad4fd239cce5eb4b4b0fde50f9cc7ca511dc6ff Mon Sep 17 00:00:00 2001 From: "wenbo.dong" Date: Wed, 13 Sep 2017 15:08:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=89=E6=8B=A9=E5=A7=93=E5=90=8D?= =?UTF-8?q?=E6=97=B6=E5=AE=9A=E4=BD=8D=E5=88=B0=E6=88=90=E5=91=98=E5=8D=B3?= =?UTF-8?q?=E5=8F=AF=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UsernameAutoComplete/UsernameAutoComplete.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/client/components/UsernameAutoComplete/UsernameAutoComplete.js b/client/components/UsernameAutoComplete/UsernameAutoComplete.js index 05c4ec6f..6f8e9235 100644 --- a/client/components/UsernameAutoComplete/UsernameAutoComplete.js +++ b/client/components/UsernameAutoComplete/UsernameAutoComplete.js @@ -91,15 +91,8 @@ class UsernameAutoComplete extends Component { dataSource: userList }); if (userList.length) { - userList.forEach((item) => { - if (item.username === this.state.changeName) { - // 每次取回搜索值后,没选择时默认选择第一位 - this.changeState(userList[0].id, userList[0].username); - } else { - // 有候选词但没有对应输入框中的字符串,此时应清空候选 uid 和 username - this.changeState(-1, ''); - } - }); + // 每次取回搜索值后,没选择时默认选择第一位 + this.changeState(userList[0].id, userList[0].username); } else { // 如果没有搜索结果,则清空候选 uid 和 username this.changeState(-1, '');