Last active
January 9, 2021 15:05
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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