fix: resolve ts errors and warnings

This commit is contained in:
Hakadao
2023-12-28 00:50:52 +08:00
parent 03e0c508cf
commit e5a8088540
2 changed files with 25 additions and 14 deletions

View File

@@ -117,7 +117,7 @@ function searchHistoryList() {
}
res.data.list.forEach((item: HistorySearchItem) => {
historyList.push(item as HistoryItem)
historyList.push(item as unknown as HistoryItem)
})
noMoreContent.value = false
@@ -154,23 +154,30 @@ function deleteHistoryItem(index: number, historyItem: HistoryItem) {
*/
function getHistoryUrl(item: HistoryItem) {
// anime
if (item.history.business === 'pgc')
if (item.history.business === 'pgc') {
return removeHttpFromUrl(item.uri)
}
// video
else if (item.history.business === 'archive')
else if (item.history.business === 'archive') {
return removeHttpFromUrl(item.history.bvid)
else if (item.history.business === 'live')
}
else if (item.history.business === 'live') {
return `//live.bilibili.com/${item.history.oid}`
else if (item.history.business === 'article')
if (item.history.cid == 0)
}
else if (item.history.business === 'article') {
if (item.history.cid === 0)
return `//www.bilibili.com/read/cv${item.history.oid}`
else return `//www.bilibili.com/read/cv${item.history.cid}`
else
return `//www.bilibili.com/read/cv${item.history.cid}`
}
return ''
}
function getHistoryItemCover(item: HistoryItem) {
if (item.history.business === 'article')
return removeHttpFromUrl(`${item.covers[0]}`)
if (item.history.business === 'article') {
if (item.covers)
return removeHttpFromUrl(`${item.covers[0]}`)
}
return removeHttpFromUrl(item.cover)
}