0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-17 16:55:12 +00:00

fix: fixed issue #158

This commit is contained in:
Alex 2022-03-22 21:23:23 +13:00
parent d91b5de945
commit fbb2ec6eb1
2 changed files with 32 additions and 6 deletions

View file

@ -42,7 +42,11 @@
>
<div class="scroll-y" style="height: 100%">
<div v-if="search" style="min-width: 180px">
<v-list-item v-for="(item, index) in response" :key="index" class="px-0">
<v-list-item
v-for="(item, index) in response"
:key="index"
class="px-0"
>
<v-btn
text
tile
@ -100,6 +104,7 @@ div {
<script>
import { App as CapacitorApp } from "@capacitor/app";
import { mapState } from "vuex";
import constants from "../plugins/constants";
export default {
data: () => ({
search: false,
@ -154,6 +159,11 @@ export default {
searchBtn(text) {
const query = text;
this.$logger(
constants.LOGGER_NAMES.search,
"Query: " + query + " this.search: " + this.search
);
if (this.search === true) {
if (query) {
this.$router.push(`/search?q=${query}`);

View file

@ -46,11 +46,27 @@ export default {
};
},
mounted() {
const searchQuestion = this.$route.query.q;
const vm = this;
this.$youtube.search(searchQuestion, (data) => {
vm.videos = data;
});
getSearch();
},
methods: {
getSearch() {
const searchQuestion = this.$route.query.q;
const vm = this;
this.$youtube.search(searchQuestion, (data) => {
vm.videos = data;
});
},
},
watch: {
// Watches for new searches while the current search page is active.
$route: {
deep: true,
handler(newSearch, oldSearch) {
if (newSearch.query.q != oldSearch.query.q) {
this.getSearch();
}
},
},
},
};
</script>