fix: ts type check
This commit is contained in:
+4
-4
@@ -17,10 +17,10 @@ const startedDate = ref<Date | null>(null);
|
|||||||
const canPlay = computed<boolean>(() => ready.value && !playing.value);
|
const canPlay = computed<boolean>(() => ready.value && !playing.value);
|
||||||
const canStop = computed<boolean>(() => ready.value && playing.value);
|
const canStop = computed<boolean>(() => ready.value && playing.value);
|
||||||
|
|
||||||
function onChangeFile(event: InputEvent): void {
|
function onChangeFile(event: Event): void {
|
||||||
ready.value = false;
|
ready.value = false;
|
||||||
file.value = URL.createObjectURL(
|
file.value = URL.createObjectURL(
|
||||||
(event.target as HTMLInputElement).files[0],
|
(event.target as HTMLInputElement).files![0] as File,
|
||||||
);
|
);
|
||||||
audio.value = new Audio(file.value);
|
audio.value = new Audio(file.value);
|
||||||
audio.value.addEventListener("loadeddata", onAudioLoadedData);
|
audio.value.addEventListener("loadeddata", onAudioLoadedData);
|
||||||
@@ -76,7 +76,7 @@ function getRemaining(): string {
|
|||||||
if (ended.value) {
|
if (ended.value) {
|
||||||
return "00:00";
|
return "00:00";
|
||||||
}
|
}
|
||||||
if (!ready.value || !playing.value) {
|
if (!ready.value || !playing.value || !startedDate.value || !audio.value) {
|
||||||
return "00:05";
|
return "00:05";
|
||||||
}
|
}
|
||||||
const d1 = Math.floor(
|
const d1 = Math.floor(
|
||||||
@@ -133,7 +133,7 @@ onMounted(() => {
|
|||||||
<LucideIcon name="square" /> Stop
|
<LucideIcon name="square" /> Stop
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<h1 :id="rid" :title="rid" :style="{ color: color }">
|
<h1 :id="rid" :title="rid" :style="{ color: color ?? '' }">
|
||||||
{{ remaining }}
|
{{ remaining }}
|
||||||
</h1>
|
</h1>
|
||||||
<hr />
|
<hr />
|
||||||
|
|||||||
Reference in New Issue
Block a user