16 lines
496 B
JavaScript
16 lines
496 B
JavaScript
// 加载组件
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// 加载 header
|
|
fetch('/components/header/header.html')
|
|
.then(response => response.text())
|
|
.then(data => {
|
|
document.getElementById('header').innerHTML = data;
|
|
});
|
|
|
|
// 加载 footer
|
|
fetch('/components/footer/footer.html')
|
|
.then(response => response.text())
|
|
.then(data => {
|
|
document.getElementById('footer').innerHTML = data;
|
|
});
|
|
});
|