1v1流程调试完成
This commit is contained in:
@@ -13,23 +13,43 @@ const props = defineProps({
|
||||
type: Number,
|
||||
default: 90,
|
||||
},
|
||||
seq: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
let barColor = "#fed847";
|
||||
if (props.tips.includes("红队")) barColor = "#FF6060";
|
||||
if (props.tips.includes("蓝队")) barColor = "#5FADFF";
|
||||
const remain = ref(props.total);
|
||||
const timer = ref(null);
|
||||
|
||||
watch(
|
||||
() => props.seq,
|
||||
() => {
|
||||
if (timer.value) clearInterval(timer.value);
|
||||
remain.value = props.total;
|
||||
timer.value = setInterval(() => {
|
||||
if (remain.value > 0) {
|
||||
remain.value--;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.start,
|
||||
(newVal, oldVal) => {
|
||||
if (oldVal === false && newVal === true) {
|
||||
remain.value = props.total;
|
||||
setInterval(() => {
|
||||
timer.value = setInterval(() => {
|
||||
if (remain.value > 0) {
|
||||
remain.value--;
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
if (timer.value) clearInterval(timer.value);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user