Skip to content

Commit

Permalink
fix: link
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jun 22, 2024
1 parent a58b726 commit 309165a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 240 deletions.
17 changes: 10 additions & 7 deletions docs/.vitepress/components/ApkDownloadButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, shallowRef, onMounted } from 'vue';
import { saveAs } from 'file-saver';
const apkUrl = shallowRef('');
const apkName = computed(() =>
Expand All @@ -10,16 +11,18 @@ const loading = shallowRef(false);
const downloadApk = async () => {
if (!apkUrl.value || loading.value) return;
loading.value = true;
const blob = await fetch(apkUrl.value)
.then((r) => r.blob())
const file = await fetch(apkUrl.value)
.then((r) => r.arrayBuffer())
.then(
(b) =>
new File([b], apkName.value, {
type: 'application/vnd.android.package-archive',
}),
)
.finally(() => {
loading.value = false;
});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.download = apkName.value;
a.href = url;
a.click();
saveAs(file, apkName.value);
};
onMounted(async () => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
},
"dependencies": {
"@gkd-kit/selector": "0.0.25",
"@types/file-saver": "2.0.7",
"@types/node": "20.11.30",
"@types/qrcode": "1.5.5",
"acorn-walk": "8.3.2",
"cross-env": "7.0.3",
"dom-serializer": "2.0.0",
"file-saver": "2.0.5",
"htmlparser2": "9.1.0",
"magic-string": "0.30.10",
"markdown-it-mathjax3": "4.3.2",
"medium-zoom": "1.1.0",
"prettier": "3.2.5",
"qrcode": "1.5.3",
"tsx": "4.7.2",
"typedoc": "0.25.13",
"typedoc-plugin-markdown": "4.0.0-next.47",
Expand Down
Loading

0 comments on commit 309165a

Please sign in to comment.