Use ref attribute to register a reference to audio element. We will later
access the audio element by the unique reference name audioElm in the
event listener.
If users click on the button, call play() method of the audio element to
play the sound.
<!doctype html><html><head><metacharset="utf-8"><title>Vue.js Play Audio Sound Onclick Demo</title><metaname="viewport"content="width=device-width, initial-scale=1"></head><body><divid="app"><buttonv-on:click="play"type="button">Click Me to Play Sound</button><audioref="audioElm"src="../../javascript/play-toggle-sound/Wat_Metta_Buddha_Qualities.mp3"></audio></div><scriptsrc="https://unpkg.com/vue@2.1.10/dist/vue.js"></script><scriptsrc="app.js"></script></body></html>