fix(StudyDetailPage): 根据文件类型调整查看文件链接行为
当文件为PDF时,保持原有点击事件;其他文件类型则直接在新标签页打开链接,以提升用户体验
Showing
1 changed file
with
2 additions
and
1 deletions
| ... | @@ -54,7 +54,8 @@ | ... | @@ -54,7 +54,8 @@ |
| 54 | <font-awesome-icon icon="file-alt" class="text-gray-400 text-lg flex-shrink-0" /> | 54 | <font-awesome-icon icon="file-alt" class="text-gray-400 text-lg flex-shrink-0" /> |
| 55 | <h3 class="text-x font-medium text-gray-900 truncate">{{ item.title }}</h3> | 55 | <h3 class="text-x font-medium text-gray-900 truncate">{{ item.title }}</h3> |
| 56 | </div> | 56 | </div> |
| 57 | - <div class="text-x text-blue-600 hover:text-blue-800 hover:underline whitespace-nowrap" @click="showPdf(item)">查看文件</div> | 57 | + <div v-if="item.url.toLowerCase().endsWith('.pdf')" class="text-x text-blue-600 hover:text-blue-800 hover:underline whitespace-nowrap" @click="showPdf(item)">查看文件</div> |
| 58 | + <a v-else :href="item.url" target="_blank" class="text-x text-blue-600 hover:text-blue-800 hover:underline whitespace-nowrap">查看文件</a> | ||
| 58 | </div> | 59 | </div> |
| 59 | </div> | 60 | </div> |
| 60 | </div> | 61 | </div> | ... | ... |
-
Please register or login to post a comment