File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,6 @@ <h2 class="title">{{infos.title}}</h2>
49
49
</ body >
50
50
51
51
< script type ="module ">
52
- import json from './data/config.json' assert { type : 'json ' } ;
53
- import info from './data/info.json' assert { type : 'json ' } ;
54
52
const app = new Vue ( {
55
53
el : '#app' ,
56
54
data : {
@@ -99,8 +97,16 @@ <h2 class="title">{{infos.title}}</h2>
99
97
window . location . hash = id ;
100
98
}
101
99
} ,
102
- mounted ( ) {
103
- document . title = info . name ;
100
+ async mounted ( ) {
101
+ // Sử dụng fetch để lấy dữ liệu JSON
102
+ const [ infoRes , albumsRes ] = await Promise . all ( [
103
+ fetch ( './data/info.json' ) ,
104
+ fetch ( './data/config.json' )
105
+ ] ) ;
106
+ this . infos = await infoRes . json ( ) ;
107
+ this . albums = await albumsRes . json ( ) ;
108
+
109
+ document . title = this . infos . name ;
104
110
this . albumsCountAnimation ( ) ;
105
111
this . initImgPreviewer ( ) ;
106
112
}
You can’t perform that action at this time.
0 commit comments