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:
parent
d91b5de945
commit
fbb2ec6eb1
2 changed files with 32 additions and 6 deletions
|
@ -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}`);
|
||||
|
|
|
@ -46,11 +46,27 @@ export default {
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
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>
|
||||
|
|
Loading…
Reference in a new issue