Skip to content

Commit

Permalink
fix safari
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Jan 3, 2024
1 parent 9e8c3b4 commit ecb9c4e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/views/discover/MediaDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,16 @@ async function handlePlay() {
const result: { [key: string]: any } = await api.get(
`mediaserver/play/${existsItemId.value}`,
)
if (result?.success)
window.open(result.data?.url, '_blank', "noopener,noreferrer")
else
$toast.error(`获取播放链接失败:${result.message}!`)
if (result?.success) {
// 打开链接地址
const a = document.createElement('a')
a.href = result.data?.url
a.target = '_blank'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
}
else { $toast.error(`获取播放链接失败:${result.message}!`) }
}
catch (error) {
console.error(error)
Expand Down

0 comments on commit ecb9c4e

Please sign in to comment.