Play audio
This commit is contained in:
20
src/scripts/components/VueSound.vue
Normal file
20
src/scripts/components/VueSound.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<script>
|
||||
|
||||
|
||||
export default {
|
||||
props: ['src', 'icon'],
|
||||
methods: {
|
||||
playSound: function(src) {
|
||||
console.log('/assets/media/' + src);
|
||||
var audioElement = document.createElement('audio');
|
||||
audioElement.setAttribute('src', '/assets/media/' + src);
|
||||
audioElement.play();
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span @click="playSound(src)" ><i class="fa ml-1 fa-play-circle"></i></span>
|
||||
</template>
|
||||
Reference in New Issue
Block a user