File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import AboutView from "@/components/AboutView.vue";
99const selectedFile = ref (null )
1010const coinsList = ref ([])
1111let isOpened = false ;
12+ const title = ref (' OpenNumismat' )
1213
1314const db = ref (null );
1415const status = ref (' ' );
@@ -86,7 +87,7 @@ const handleFileUpload = async (file) => {
8687 @click =" router.back()"
8788 ></v-app-bar-nav-icon >
8889
89- <v-toolbar-title >OpenNumismat </v-toolbar-title >
90+ <v-toolbar-title >{{ title }} </v-toolbar-title >
9091 </v-app-bar >
9192
9293 <v-navigation-drawer v-model =" drawer" temporary >
@@ -110,13 +111,13 @@ const handleFileUpload = async (file) => {
110111
111112 <v-main >
112113 <div v-if =" (route.name === 'home' && !isOpened) || route.name === 'open'" >
113- <FileUploaderView :onFileUploaded =" handleFileUpload" />
114+ <FileUploaderView v-model:title = " title " :onFileUploaded =" handleFileUpload" />
114115 </div >
115116 <div v-if =" route.name === 'home' && isOpened" >
116- <CoinListView :file_name =" selectedFile.name" :coins_list =" coinsList" />
117+ <CoinListView v-model:title = " title " :file_name =" selectedFile.name" :coins_list =" coinsList" />
117118 </div >
118119 <div v-if =" route.name === 'about'" >
119- <AboutView />
120+ <AboutView v-model:title = " title " />
120121 </div >
121122 <div v-if =" status" class =" status" >{{ status }}</div >
122123 </v-main >
Original file line number Diff line number Diff line change 11<script setup>
2+ import {defineProps , onMounted , onUnmounted } from " vue" ;
3+
24const appVersion = import .meta.env.VITE_APP_VERSION;
5+
6+ const props = defineProps ({
7+ title: String ,
8+ });
9+ const emit = defineEmits ([' update:title' ]);
10+ let oldTitle = null ;
11+
12+ onMounted (async () => {
13+ oldTitle = props .title ;
14+ emit (' update:title' , ' About' );
15+ })
16+ onUnmounted (async () => {
17+ emit (' update:title' , oldTitle);
18+ })
319 </script >
420
521<template >
Original file line number Diff line number Diff line change 11<script setup>
2- import { defineProps } from ' vue' ;
2+ import {defineProps , onMounted , onUnmounted } from " vue" ;
33
4- defineProps ({
4+ const props = defineProps ({
5+ title: String ,
56 file_name: {
67 type: String ,
78 required: true ,
@@ -12,14 +13,24 @@ defineProps({
1213 },
1314});
1415
16+ const emit = defineEmits ([' update:title' ]);
17+ let oldTitle = null ;
18+
19+ onMounted (async () => {
20+ oldTitle = props .title ;
21+ emit (' update:title' , props .file_name );
22+ })
23+ onUnmounted (async () => {
24+ emit (' update:title' , oldTitle);
25+ })
26+
1527function arrayBufferToBase64 ( buffer ) {
1628 let binary = ' ' ;
1729 const bytes = new Uint8Array ( buffer );
1830 const len = bytes .byteLength ;
1931 for (let i = 0 ; i < len; i++ ) {
2032 binary += String .fromCharCode ( bytes[ i ] );
2133 }
22- // return window.btoa( binary );
2334 const base64String = window .btoa ( binary );
2435 return ` data:image/png;base64,${ base64String} ` ;
2536}
@@ -45,8 +56,6 @@ function generateDescription( coin_data ) {
4556 </script >
4657
4758<template >
48- <h2 class =" file-name" >{{ file_name }}</h2 >
49-
5059 <div >
5160 <table >
5261 <tr v-for =" coin_data in coins_list" >
Original file line number Diff line number Diff line change 11<script setup>
2+ import {defineProps , onMounted , onUnmounted } from " vue" ;
3+ import {useRoute } from " vue-router" ;
24import { VFileUpload } from ' vuetify/labs/VFileUpload'
35
46const props = defineProps ({
7+ title: String ,
58 onFileUploaded: Function ,
69});
710
11+ const emit = defineEmits ([' update:title' ]);
12+ let oldTitle = null ;
13+
14+ const route = useRoute ()
15+
16+ onMounted (async () => {
17+ oldTitle = props .title ;
18+ if (route .name === ' open' )
19+ emit (' update:title' , ' Open File' );
20+ })
21+ onUnmounted (async () => {
22+ emit (' update:title' , oldTitle);
23+ })
24+
825function onFileChange (event ) {
926 console .log (' Selected files:' , event .target .files );
1027
You can’t perform that action at this time.
0 commit comments