File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 2
2
<div class =" row input-search" >
3
3
<div class =" input-field col s12" >
4
4
<i class =" material-icons prefix" >search</i >
5
- <input id =" search" type =" search" @input = " onChange " autocomplete =" off" />
5
+ <input id =" search" type =" search" v-model = " searchTerm " autocomplete =" off" />
6
6
<label for =" search" >{{ label }}</label >
7
7
</div >
8
8
</div >
@@ -17,9 +17,22 @@ export default {
17
17
required: true
18
18
}
19
19
},
20
- methods: {
21
- onChange ({ target: { value } }) {
22
- this .$emit (" input" , value .trim ());
20
+ data () {
21
+ return {
22
+ searchTerm: " "
23
+ };
24
+ },
25
+ activated () {
26
+ this .searchTerm = " " ;
27
+ // We are using keep-alive, and when we leave the screen while the input is focused all
28
+ // the states are preserved, so we need to restore the input to its initial state.
29
+ this .$nextTick (() => {
30
+ M .updateTextFields ();
31
+ });
32
+ },
33
+ watch: {
34
+ searchTerm (newVal ) {
35
+ this .$emit (" input" , newVal .trim ());
23
36
}
24
37
}
25
38
};
You can’t perform that action at this time.
0 commit comments