2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
2023-06-04 12:25:47 -04:00
|
|
|
<a :class="{ 'is-info': !is_repeat_off }" @click="toggle_repeat_mode">
|
|
|
|
<span class="icon"
|
|
|
|
><mdicon
|
|
|
|
:name="icon_name"
|
|
|
|
:size="icon_size"
|
|
|
|
:title="$t('player.button.' + icon_name)"
|
|
|
|
/></span>
|
2018-08-11 01:47:10 -04:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PlayerButtonRepeat',
|
|
|
|
|
2020-04-18 00:57:55 -04:00
|
|
|
props: {
|
2022-04-16 04:14:03 -04:00
|
|
|
icon_size: {
|
|
|
|
type: Number,
|
|
|
|
default: 16
|
|
|
|
}
|
2018-08-11 01:47:10 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2022-02-19 00:39:14 -05:00
|
|
|
is_repeat_all() {
|
2018-08-11 01:47:10 -04:00
|
|
|
return this.$store.state.player.repeat === 'all'
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
is_repeat_single() {
|
2018-08-11 01:47:10 -04:00
|
|
|
return this.$store.state.player.repeat === 'single'
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
is_repeat_off() {
|
2018-08-11 01:47:10 -04:00
|
|
|
return !this.is_repeat_all && !this.is_repeat_single
|
2022-04-16 04:14:03 -04:00
|
|
|
},
|
|
|
|
icon_name() {
|
|
|
|
if (this.is_repeat_all) {
|
|
|
|
return 'repeat'
|
|
|
|
} else if (this.is_repeat_single) {
|
|
|
|
return 'repeat-once'
|
|
|
|
}
|
|
|
|
return 'repeat-off'
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
toggle_repeat_mode: function () {
|
|
|
|
if (this.is_repeat_all) {
|
|
|
|
webapi.player_repeat('single')
|
|
|
|
} else if (this.is_repeat_single) {
|
|
|
|
webapi.player_repeat('off')
|
|
|
|
} else {
|
|
|
|
webapi.player_repeat('all')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
<style></style>
|