fix: disable Download button after completion, reset on format change

This commit is contained in:
mini
2026-02-18 22:44:54 +08:00
parent d3eed07e44
commit 25c4973f57

View File

@@ -20,15 +20,15 @@
<div class="formats"> <div class="formats">
<h4>Select Quality:</h4> <h4>Select Quality:</h4>
<div v-for="fmt in videoInfo.formats" :key="fmt.format_id" class="format-item" <div v-for="fmt in videoInfo.formats" :key="fmt.format_id" class="format-item"
:class="{ selected: selectedFormat === fmt.format_id }" @click="selectedFormat = fmt.format_id"> :class="{ selected: selectedFormat === fmt.format_id }" @click="selectedFormat = fmt.format_id; downloadReady = false; taskId = ''; progress = 0">
<span class="quality">{{ fmt.quality }}</span> <span class="quality">{{ fmt.quality }}</span>
<span class="ext">{{ fmt.ext }}</span> <span class="ext">{{ fmt.ext }}</span>
<span v-if="fmt.filesize" class="size">~{{ humanSize(fmt.filesize) }}</span> <span v-if="fmt.filesize" class="size">~{{ humanSize(fmt.filesize) }}</span>
</div> </div>
</div> </div>
<button class="download-btn" @click="startDownload" :disabled="downloading"> <button class="download-btn" @click="startDownload" :disabled="downloading || downloadReady">
{{ downloading ? '⏳ Downloading...' : '📥 Download' }} {{ downloading ? '⏳ Downloading...' : downloadReady ? '✅ Downloaded' : '📥 Download' }}
</button> </button>
</div> </div>