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 class="scroll-y" style="height: 100%">
|
||||||
<div v-if="search" style="min-width: 180px">
|
<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
|
<v-btn
|
||||||
text
|
text
|
||||||
tile
|
tile
|
||||||
|
@ -100,6 +104,7 @@ div {
|
||||||
<script>
|
<script>
|
||||||
import { App as CapacitorApp } from "@capacitor/app";
|
import { App as CapacitorApp } from "@capacitor/app";
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
|
import constants from "../plugins/constants";
|
||||||
export default {
|
export default {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
search: false,
|
search: false,
|
||||||
|
@ -154,6 +159,11 @@ export default {
|
||||||
searchBtn(text) {
|
searchBtn(text) {
|
||||||
const query = text;
|
const query = text;
|
||||||
|
|
||||||
|
this.$logger(
|
||||||
|
constants.LOGGER_NAMES.search,
|
||||||
|
"Query: " + query + " this.search: " + this.search
|
||||||
|
);
|
||||||
|
|
||||||
if (this.search === true) {
|
if (this.search === true) {
|
||||||
if (query) {
|
if (query) {
|
||||||
this.$router.push(`/search?q=${query}`);
|
this.$router.push(`/search?q=${query}`);
|
||||||
|
|
|
@ -46,11 +46,27 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
getSearch();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getSearch() {
|
||||||
const searchQuestion = this.$route.query.q;
|
const searchQuestion = this.$route.query.q;
|
||||||
const vm = this;
|
const vm = this;
|
||||||
this.$youtube.search(searchQuestion, (data) => {
|
this.$youtube.search(searchQuestion, (data) => {
|
||||||
vm.videos = 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>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue