mac不强制更新

This commit is contained in:
2026-03-13 17:48:00 +08:00
parent 1dd64988ba
commit 44df456240
5 changed files with 218 additions and 87 deletions

View File

@@ -38,10 +38,31 @@
<p v-if="updateInfo.releaseNotes" class="text-gray-500 text-xs bg-gray-50 p-2 rounded-lg line-clamp-3">
{{ updateInfo.releaseNotes }}
</p>
<button @click="downloadUpdate"
class="w-full py-2 bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-lg font-medium hover:from-blue-600 hover:to-blue-700 transition-all shadow-md hover:shadow-lg">
下载更新
</button>
<!-- Mac 用户跳转下载页面 -->
<template v-if="isMac">
<p class="text-amber-600 text-sm bg-amber-50 p-2 rounded-lg">
Mac 版本请前往官网下载最新安装包
</p>
<div class="flex gap-2">
<button @click="openDownloadPage"
class="flex-1 py-2 bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-lg font-medium hover:from-blue-600 hover:to-blue-700 transition-all shadow-md hover:shadow-lg">
前往下载
</button>
<button @click="dismissUpdate"
class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg font-medium hover:bg-gray-200 transition-all">
稍后提醒
</button>
</div>
</template>
<!-- Windows 用户正常下载更新 -->
<template v-else>
<button @click="downloadUpdate"
class="w-full py-2 bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-lg font-medium hover:from-blue-600 hover:to-blue-700 transition-all shadow-md hover:shadow-lg">
下载更新
</button>
</template>
</div>
<!-- 下载中 -->
@@ -107,6 +128,7 @@ const {
progress,
error,
currentVersion,
isMac,
checkForUpdates,
downloadUpdate,
installUpdate,
@@ -120,4 +142,13 @@ function formatBytes(bytes) {
const i = Math.floor(Math.log(bytes) / Math.log(k))
return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}`
}
// 打开下载页面
const openDownloadPage = () => {
if (isElectronEnv) {
window.electronAPI.openExternal?.('https://yolozs.com/')
} else {
window.open('https://yolozs.com/', '_blank')
}
}
</script>