效果
代码实现

{{ count }}秒后返回网站首页
import router from "/@/router";
import {onMounted, reactive, ref} from "vue";
export default {
setup(): any {
onMounted(() => {
countdown() //页面一加载成功就执行
})
let timer = null
let count: number = ref(10)
//倒计时
function countdown() {
timer = setInterval(() => {
count.value = count.value-1
if (count.value
关注
打赏