I'm struggling to understand how I can pass the name of a sound effect as a parameter to the play constant set in the setup and thus play the sound effect "button2" instead of "buttonSFX".
<script> import { useSound } from '@vueuse/sound'
import buttonSfx from '../assets/button.mp3'
import button2 from '../assets/button2.mp3'
export default {
setup() {
const { play } = useSound(buttonSfx)
return {
play,
}
},
}
</script>
Here is how I got it to work