|
| 1 | +<script setup> |
| 2 | +const platform = { |
| 3 | + MacIntel: 'x64.dmg', |
| 4 | + Win32: 'Setup.exe', |
| 5 | + 'Linux x86_64': '_amd64.deb', |
| 6 | + 'Linux armv81': '_arm64.deb' |
| 7 | +}; |
| 8 | +const getLatestLinks = async () => { |
| 9 | + const data = await fetch('https://api.github.com/repos/geek-fun/dockit/releases/latest') |
| 10 | + .then((res) => res.json()) |
| 11 | + .catch((err) => console.error(err)); |
| 12 | + return data.assets.map((item) => ({ |
| 13 | + name: item.name, |
| 14 | + url: item.browser_download_url |
| 15 | + })); |
| 16 | +} |
| 17 | +
|
| 18 | +const downloadFn = async (event) => { |
| 19 | + // const links = await getLatestLinks(); |
| 20 | + // const link = links.find((item) => item.name.includes(platform[window.navigator.platform])); |
| 21 | + // console.log('downloadFn', fetch(link.url)) |
| 22 | + console.log('downloadFn',window.navigator) |
| 23 | + console.log('downloadFnJson',{ nv: JSON.stringify(window.navigator)}) |
| 24 | +} |
| 25 | +</script> |
| 26 | +<template> |
| 27 | + <p> |
| 28 | + Download the the latest of DocKit for your platform, or you can find the historic/cross-platforms version in |
| 29 | + <a href="https://github.com/geek-fun/dockit/releases">github release</a> |
| 30 | + </p> |
| 31 | + <button :class="$style.downloadButton" @click="downloadFn"><i class="fab fa-apple"></i>Download DocKit</button> |
| 32 | +</template> |
| 33 | +<style module> |
| 34 | +.downloadButton { |
| 35 | + display: inline-block; |
| 36 | + padding: 10px; |
| 37 | + font-size: 16px; |
| 38 | + font-weight: bold; |
| 39 | + text-align: center; |
| 40 | + text-decoration: none; |
| 41 | + background-color: #87CEFA; /* Light Blue color */ |
| 42 | + color: #fff; |
| 43 | + border: 1px solid #87CEFA; /* Light Blue color */ |
| 44 | + border-radius: 10px; /* Rounded corners */ |
| 45 | + cursor: pointer; |
| 46 | + transition: background-color 0.3s; |
| 47 | + margin-right: 10px; /* Add some space between buttons */ |
| 48 | +} |
| 49 | +
|
| 50 | +.downloadButton:hover { |
| 51 | + background-color: #6495ED; /* Slightly darker blue on hover */ |
| 52 | +} |
| 53 | +
|
| 54 | +.downloadButton i { |
| 55 | + margin-right: 8px; /* Adjust the space between icon and text */ |
| 56 | +} |
| 57 | +</style> |
0 commit comments