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

Header: no transition page on submit

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

+ 6 - 0
resource/js/components/Header/SearchForm.js

@@ -12,6 +12,7 @@ export default class SearchForm extends React.Component {
     };
     };
 
 
     this.handleChange = this.handleChange.bind(this);
     this.handleChange = this.handleChange.bind(this);
+    this.handleSubmit = this.handleSubmit.bind(this);
     this.ticker = null;
     this.ticker = null;
   }
   }
 
 
@@ -34,6 +35,10 @@ export default class SearchForm extends React.Component {
     this.search();
     this.search();
   }
   }
 
 
+  handleSubmit(event) {
+    event.preventDefault();
+  }
+
   handleChange(event) {
   handleChange(event) {
     const keyword = event.target.value;
     const keyword = event.target.value;
     this.setState({keyword});
     this.setState({keyword});
@@ -44,6 +49,7 @@ export default class SearchForm extends React.Component {
       <form
       <form
         action="/_search"
         action="/_search"
         className="search-form form-group input-group search-top-input-group"
         className="search-form form-group input-group search-top-input-group"
+        onSubmit={this.handleSubmit}
       >
       >
         <input
         <input
           autocomplete="off"
           autocomplete="off"