client/src/components/Radio.vue
Artem Anufrij 3af8005786 move
2023-02-08 12:37:55 +01:00

34 lines
816 B
Vue

<template>
<div :title="item.name" class="container radio" @click="clicked">
<img class="radioCover shadow" :src="item.cover128" />
<p
class="radioTitle"
:class="{ selected: item == $store.state.selectedRadio }"
>
{{ item.name }}
</p>
</div>
</template>
<script>
import BaseCollection from "../mixins/BaseCollection";
export default {
name: "RadioItem",
mixins: [BaseCollection],
mounted() {
if (this.$route.query.play == this.item._id) {
this.$store.dispatch("radios/play", this.item);
}
},
methods: {
clicked() {
if (this.$route.path == "/" || this.$route.path == "/search") {
this.$router.push("/radios?play=" + this.item._id);
} else {
this.$store.dispatch("radios/play", this.item);
}
},
},
};
</script>