完成单组练习接口调试

This commit is contained in:
kron
2025-05-29 23:45:44 +08:00
parent 6466c65b66
commit 9db31ce664
14 changed files with 282 additions and 122 deletions

View File

@@ -1,6 +1,10 @@
<script setup>
import { ref, onMounted } from "vue";
import { ref, watch } from "vue";
const props = defineProps({
start: {
type: Boolean,
default: false,
},
tips: {
type: String,
default: "",
@@ -10,18 +14,25 @@ const props = defineProps({
default: 90,
},
});
let barColor = "#fed847";
if (props.tips.includes("红队")) barColor = "#FF6060";
if (props.tips.includes("蓝队")) barColor = "#5FADFF";
const remain = ref(0);
onMounted(() => {
remain.value = props.total;
setInterval(() => {
if (remain.value > 0) {
remain.value--;
const remain = ref(props.total);
watch(
() => props.start,
(newVal, oldVal) => {
if (oldVal === false && newVal === true) {
remain.value = props.total;
setInterval(() => {
if (remain.value > 0) {
remain.value--;
}
}, 1000);
}
}, 1000);
});
}
);
</script>
<template>