Tile work
This commit is contained in:
23
src/components/screens/Login.vue
Normal file
23
src/components/screens/Login.vue
Normal file
@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<audio ref="bgm" id="bgm" src="@/assets/sound/bgm.mp3" loop autoplay></audio>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
const bgm = ref(null)
|
||||
const bgmStart = () => bgm.value.play();
|
||||
|
||||
onMounted(() => {
|
||||
// check if bgm is playing already and do nothing
|
||||
if (bgm.value.paused) {
|
||||
window.addEventListener('click', () => bgm.value.play())
|
||||
window.addEventListener('keydown', () => bgm.value.play())
|
||||
window.addEventListener('mousemove', () => bgm.value.play())
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
Reference in New Issue
Block a user