1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-13 13:50:27 +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
>
</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">
<ul class="uk-navbar-nav">
<li>
@ -33,9 +42,26 @@
</template>
<script>
import Constants from "@/Constants.js";
export default {
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>