player stop

This commit is contained in:
2021-05-24 21:01:01 +08:00
parent c9b4e456da
commit 5cf24f95fe
2 changed files with 9 additions and 1 deletions

View File

@@ -29,7 +29,7 @@
<router-view :token="token" @set_token="set_token" @play_audio="play_audio"></router-view> <router-view :token="token" @set_token="set_token" @play_audio="play_audio"></router-view>
</main> </main>
<footer> <footer>
<component-audio-player :file=playing_audio_file></component-audio-player> <component-audio-player @stop="stop" :file=playing_audio_file></component-audio-player>
<p>{{ token }}</p> <p>{{ token }}</p>
</footer> </footer>
</div> </div>

View File

@@ -477,6 +477,7 @@ const component_file = {
} }
const component_audio_player = { const component_audio_player = {
emits: ['stop'],
data() { data() {
return { return {
loop: true, loop: true,
@@ -499,6 +500,7 @@ const component_audio_player = {
<button @click="dialog">{{ file.filename }}</button> <button @click="dialog">{{ file.filename }}</button>
<button @click="show_folder">{{ file.foldername }}</button> <button @click="show_folder">{{ file.foldername }}</button>
<button>{{ computed_readable_size }}</button> <button>{{ computed_readable_size }}</button>
<button @click="emit_stop">Stop</button>
</span> </span>
<br /> <br />
<input type="checkbox" v-model="loop" /> <input type="checkbox" v-model="loop" />
@@ -510,6 +512,9 @@ const component_audio_player = {
</div> </div>
`, `,
methods: { methods: {
emit_stop() {
this.$emit('stop')
},
dialog() { dialog() {
this.show_dialog = this.show_dialog ? false : true this.show_dialog = this.show_dialog ? false : true
}, },
@@ -764,6 +769,9 @@ const app = Vue.createApp({
} }
}, },
methods: { methods: {
stop() {
this.playing_audio_file = {}
},
set_token(token) { set_token(token) {
this.token = token this.token = token
}, },