<template>
<!-- <router-view/>-->
<el-button ref="btnRef" @click="change">点击菜单</el-button>
<audio controls autoplay ref="audioRef" >
<source muted src="http://172.18.248.205/group1/M00/7A/39/rBL4zWSnqf6AKvn-AAhzU9tZ80k074.wav" type="audio/wav"/>
</audio>
</template>
<script lang="ts" setup>
import {onMounted, ref, watch, watchEffect} from "vue";
const audioRef = ref();
const btnRef = ref();
const status = ref();
let play = function () {
console.log("啥也不干...");
watch(() => {
console.log(status.value);
if (status.value) {
audioRef.value.play()
}
})
};
onMounted(() => {
setTimeout(() => {
status.value = 22;
}, 5000);
})
const change = function () {
play();
};
</script>