Просмотр исходного кода

On empty keyword, remove suggest box

Sotaro KARASAWA 10 лет назад
Родитель
Сommit
5ef14fc7e9
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      resource/js/components/Header/SearchBox.js

+ 7 - 0
resource/js/components/Header/SearchBox.js

@@ -22,6 +22,13 @@ export default class SearchBox extends React.Component {
 
   search(data) {
     const keyword = data.keyword;
+    if (keyword === '') {
+      this.setState({
+        searchedPages: [],
+      });
+
+      return true;
+    }
 
     axios.get('/_api/search', {params: {q: keyword}})
     .then((res) => {