剪切板 mac前去下载

This commit is contained in:
2026-03-13 18:01:38 +08:00
parent 44df456240
commit 7e3b7448fa

View File

@@ -76,14 +76,17 @@
<p class="text-gray-600 text-sm whitespace-pre-wrap">{{ updateInfo.releaseNotes }}</p> <p class="text-gray-600 text-sm whitespace-pre-wrap">{{ updateInfo.releaseNotes }}</p>
</div> </div>
<!-- Mac 用户跳转下载页面 --> <!-- Mac 用户复制下载链接 -->
<template v-if="isMac"> <template v-if="isMac">
<p class="text-amber-600 text-sm bg-amber-50 p-3 rounded-lg text-center"> <p class="text-amber-600 text-sm bg-amber-50 p-3 rounded-lg text-center">
Mac 版本请前往官网下载最新安装包 Mac 版本请复制下方链接在浏览器中打开下载最新安装包
</p> </p>
<button @click="openDownloadPage" <div class="bg-gray-50 rounded-lg p-3 text-center">
<span class="text-blue-600 text-sm break-all select-all">{{ downloadUrl }}</span>
</div>
<button @click="copyDownloadUrl"
class="w-full py-3 bg-gradient-to-r from-blue-600 to-blue-500 text-white rounded-lg font-medium hover:from-blue-700 hover:to-blue-600 transition-all shadow-sm"> class="w-full py-3 bg-gradient-to-r from-blue-600 to-blue-500 text-white rounded-lg font-medium hover:from-blue-700 hover:to-blue-600 transition-all shadow-sm">
前往下载 {{ copySuccess ? '已复制' : '复制链接' }}
</button> </button>
</template> </template>
@@ -212,6 +215,8 @@ const retryCount = ref(0)
const isTimeout = ref(false) const isTimeout = ref(false)
const showTimeoutError = ref(false) const showTimeoutError = ref(false)
const countdown = ref(AUTO_INSTALL_DELAY) const countdown = ref(AUTO_INSTALL_DELAY)
const downloadUrl = 'https://yolozs.com/'
const copySuccess = ref(false)
let timeoutTimer = null let timeoutTimer = null
let hasStarted = false let hasStarted = false
@@ -319,13 +324,12 @@ function formatBytes(bytes) {
return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}` return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}`
} }
// 打开下载页面Mac 用户) // 复制下载链接Mac 用户)
function openDownloadPage() { function copyDownloadUrl() {
if (isElectronEnv) { navigator.clipboard.writeText(downloadUrl).then(() => {
window.electronAPI.openExternal?.('https://yolozs.com/') copySuccess.value = true
} else { setTimeout(() => { copySuccess.value = false }, 2000)
window.open('https://yolozs.com/', '_blank') })
}
} }
onUnmounted(() => { onUnmounted(() => {