Skip to content

Commit 27d61ba

Browse files
Update index.html
1 parent 6ab8778 commit 27d61ba

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

index.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ <h2 class="title">{{infos.title}}</h2>
4949
</body>
5050

5151
<script type="module">
52-
import json from './data/config.json' assert { type: 'json' };
53-
import info from './data/info.json' assert { type: 'json' };
5452
const app = new Vue({
5553
el: '#app',
5654
data: {
@@ -99,8 +97,16 @@ <h2 class="title">{{infos.title}}</h2>
9997
window.location.hash = id;
10098
}
10199
},
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;
104110
this.albumsCountAnimation();
105111
this.initImgPreviewer();
106112
}

0 commit comments

Comments
 (0)