|
1 | 1 | <script setup> |
2 | 2 | import {defineProps, onMounted, onUnmounted, ref} from "vue"; |
3 | | -import {useRoute} from "vue-router"; |
| 3 | +import {useRoute, useRouter} from "vue-router"; |
4 | 4 | import {useSQLite} from "@/composables/useSQLite.js"; |
| 5 | +import {arrayBufferToBase64} from "@/utils/bytes2img.js" |
5 | 6 |
|
| 7 | +const router = useRouter() |
6 | 8 | const route = useRoute() |
7 | 9 |
|
8 | 10 | const {isLoading, |
@@ -43,22 +45,15 @@ onMounted(async () => { |
43 | 45 | onUnmounted(async () => { |
44 | 46 | emit('update:title', oldTitle); |
45 | 47 | }) |
46 | | -
|
47 | | -function arrayBufferToBase64( buffer ) { |
48 | | - let binary = ''; |
49 | | - const bytes = new Uint8Array( buffer ); |
50 | | - const len = bytes.byteLength; |
51 | | - for (let i = 0; i < len; i++) { |
52 | | - binary += String.fromCharCode( bytes[ i ] ); |
53 | | - } |
54 | | - const base64String = window.btoa( binary ); |
55 | | - return `data:image/png;base64,${base64String}`; |
56 | | -} |
57 | 48 | </script> |
58 | 49 |
|
59 | 50 | <template> |
60 | | - <v-img :src="arrayBufferToBase64(coinData[infoFieldIndex('obverseimg.image')])" :width="200" /> |
61 | | - <v-img :src="arrayBufferToBase64(coinData[infoFieldIndex('reverseimg.image')])" :width="200" /> |
| 51 | + <v-img :src="arrayBufferToBase64(coinData[infoFieldIndex('obverseimg.image')])" |
| 52 | + :width="200" |
| 53 | + @click="router.push('/images/' + route.params['id'])" /> |
| 54 | + <v-img :src="arrayBufferToBase64(coinData[infoFieldIndex('reverseimg.image')])" |
| 55 | + :width="200" |
| 56 | + @click="router.push('/images/' + route.params['id'])" /> |
62 | 57 | {{ coinData[infoFieldIndex('status')] }} |
63 | 58 | {{ coinData[infoFieldIndex('country')] }} |
64 | 59 | {{ coinData[infoFieldIndex('type')] }} |
|
0 commit comments