1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-13 22:00:28 +05:30

Search suggestions and box.

This commit is contained in:
FireMasterK 2020-11-25 10:50:44 +05:30
parent c5801c437e
commit dfa94f6d7f

View File

@ -13,6 +13,15 @@
>Piped</router-link >Piped</router-link
> >
</div> </div>
<div class="uk-navbar-center">
<input
class="uk-input uk-form-width-large"
type="text"
placeholder="Search"
v-model="searchText"
@keypress="onChange($event)"
/>
</div>
<div class="uk-navbar-right"> <div class="uk-navbar-right">
<ul class="uk-navbar-nav"> <ul class="uk-navbar-nav">
<li> <li>
@ -33,9 +42,26 @@
</template> </template>
<script> <script>
import Constants from "@/Constants.js";
export default { export default {
data() { data() {
return {}; return {
searchText: "",
searchSuggestions: []
};
},
methods: {
onChange(e) {
fetch(
Constants.BASE_URL +
"/suggestions?query=" +
encodeURI(this.searchText + e.key)
)
.then(resp => resp.json())
.then(json => {
this.searchSuggestions = json;
});
}
} }
}; };
</script> </script>