1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <template>
- <section class="video section">
- <div class="video__wrapper section-wrapper podcasts-wrapper">
- <h1 class="podcast-h1">Слушай</h1>
- <template v-if="podcasts.length">
- <PodcastList
- v-if="podcasts.length > 0"
- v-for="podcast in podcasts"
- :podcast="podcast">
- </PodcastList>
- </template>
- </div>
- </section>
- </template>
- <script>
- import { mapGetters } from "vuex";
- export default {
- data: () => ({
- podcasts: [],
- }),
- computed: {
- ...mapGetters({
- allCategories: "modules/news/categoriesList",
- }),
- categories() {
- return this.allCategories.data.find((cat) => cat.alias === "slushay").child;
- },
- },
- props: {
- category: {
- type: Object
- }
- },
- methods: {
- loadPodcasts(category) {
- return this.$axios
- .get(`/news/category/${category.alias}`)
- .then((res) => res.data.data);
- },
- },
- async mounted() {
- const promises = this.categories.map(this.loadPodcasts);
- this.podcasts = await Promise.all(promises);
- console.log(this.podcasts.length);
- },
- head() {
- return {
- title: 'Амик - Подкасты',
- meta: [
- {
- name: "description",
- content: "",
- },
- {
- name: "keys",
- content: "",
- },
- ],
- link: [
- {rel: 'canonical', href: 'https://www.amic.ru/podcasts'}
- ]
- };
- },
- async asyncData({store}) {
- await store.dispatch("modules/ads/getAds");
- await store.dispatch("modules/news/setCategoriesList");
- }
- };
- </script>
- <style>
- .podcast-h1{
- margin-bottom: 30px;
- }
- </style>
|