fix: fix manual download button layout and polish

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wizardchen
2026-03-16 18:29:59 +08:00
parent 70b73cd257
commit e609bd2c4c
+10 -6
View File
@@ -627,7 +627,9 @@ const downloadFile = () => {
const link = document.createElement("a"); const link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.setAttribute("href", url.value); link.setAttribute("href", url.value);
link.setAttribute("download", props.details.type === 'manual' ? props.details.title + '.md' : props.details.title); const needsExt = props.details.type === 'manual' && !props.details.title.toLowerCase().endsWith('.md');
const ext = needsExt ? '.md' : '';
link.setAttribute("download", props.details.title + ext);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
nextTick(() => { nextTick(() => {
@@ -695,11 +697,13 @@ const handleDetailsScroll = () => {
<!-- 手动创建类型专属区域 --> <!-- 手动创建类型专属区域 -->
<div v-else-if="details.type === 'manual'" class="manual_box"> <div v-else-if="details.type === 'manual'" class="manual_box">
<span class="label">{{ $t('knowledgeBase.documentTitle') }}</span> <span class="label">{{ $t('knowledgeBase.documentTitle') }}</span>
<div class="manual_title_box"> <div class="download_box">
<span class="manual_title">{{ details.title }}</span> <div class="manual_title_box">
</div> <span class="manual_title">{{ details.title }}</span>
<div class="icon_box" @click="downloadFile()"> </div>
<img class="download_box" src="@/assets/img/download.svg" alt=""> <div class="icon_box" @click="downloadFile()" aria-label="Download">
<img class="download_box" src="@/assets/img/download.svg" alt="">
</div>
</div> </div>
</div> </div>