mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-11-22 11:15:14 +00:00
global search loading state, fixes #463
This commit is contained in:
parent
e1a1cfe6e9
commit
9eef8d8762
4 changed files with 25 additions and 14 deletions
|
@ -52,6 +52,7 @@
|
||||||
v-if="$route.name !== 'settings' && !$route.path.includes('/mods')"
|
v-if="$route.name !== 'settings' && !$route.path.includes('/mods')"
|
||||||
icon
|
icon
|
||||||
tile
|
tile
|
||||||
|
:loading="$store.state.search.loading"
|
||||||
class="ml-3 my-auto fill-height"
|
class="ml-3 my-auto fill-height"
|
||||||
style="border-radius: 0.25rem !important"
|
style="border-radius: 0.25rem !important"
|
||||||
@click="$emit('search-btn', text)"
|
@click="$emit('search-btn', text)"
|
||||||
|
|
|
@ -199,6 +199,7 @@ export default {
|
||||||
|
|
||||||
if (this.search === true) {
|
if (this.search === true) {
|
||||||
if (query) {
|
if (query) {
|
||||||
|
this.$store.commit("search/setLoading", true);
|
||||||
this.$router.push(`/search?q=${query}`);
|
this.$router.push(`/search?q=${query}`);
|
||||||
this.search = false;
|
this.search = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,20 +6,6 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.entry {
|
|
||||||
width: 100%; /* Prevent Loading Weirdness */
|
|
||||||
}
|
|
||||||
.videoRuntimeFloat {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 10px;
|
|
||||||
right: 10px;
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 0px 4px 0px 4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import sectionListRenderer from "~/components/ListRenderers/sectionListRenderer.vue";
|
import sectionListRenderer from "~/components/ListRenderers/sectionListRenderer.vue";
|
||||||
import VidLoadRenderer from "~/components/vidLoadRenderer.vue";
|
import VidLoadRenderer from "~/components/vidLoadRenderer.vue";
|
||||||
|
@ -52,9 +38,24 @@ export default {
|
||||||
getSearch() {
|
getSearch() {
|
||||||
const searchQuestion = this.$route.query.q;
|
const searchQuestion = this.$route.query.q;
|
||||||
this.$youtube.search(searchQuestion).then((response) => {
|
this.$youtube.search(searchQuestion).then((response) => {
|
||||||
|
this.$store.commit("search/setLoading", false);
|
||||||
this.renderer = response;
|
this.renderer = response;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.entry {
|
||||||
|
width: 100%; /* Prevent Loading Weirdness */
|
||||||
|
}
|
||||||
|
.videoRuntimeFloat {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
right: 10px;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 0px 4px 0px 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
8
NUXT/store/search/index.js
Normal file
8
NUXT/store/search/index.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
export const state = () => ({
|
||||||
|
loading: false,
|
||||||
|
});
|
||||||
|
export const mutations = {
|
||||||
|
setLoading(state, payload) {
|
||||||
|
state.loading = payload;
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in a new issue