Skip to content

Instantly share code, notes, and snippets.

@Tahul
Last active January 9, 2021 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tahul/d0a2b48d1698ae641cba132de4dee896 to your computer and use it in GitHub Desktop.
Save Tahul/d0a2b48d1698ae641cba132de4dee896 to your computer and use it in GitHub Desktop.
[vue-use-sound basic example] vue-use-sound basic example #vue #vue-compositon-api #vue3 #sound #audio
<template>
<button @click="playButton" />
</template>
<script>
// NPM
import useSound from 'vue-use-sound'
// Assets
import buttonSfx from '@/assets/sounds/pop-down.mp3'
export default {
setup() {
const [playButton] = useSound(buttonSfx)
return {
playButton
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment