62 lines
1.3 KiB
HTML
62 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Document</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
font-size: 0;
|
|
line-height: 0;
|
|
}
|
|
ul {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
}
|
|
ul li {
|
|
width: 20%;
|
|
background: #000;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
}
|
|
ul li img {
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<ul></ul>
|
|
</body>
|
|
<script>
|
|
fetch("http://127.0.0.1:3000/")
|
|
.then((response) => response.json())
|
|
.then((data) => {
|
|
console.log(data);
|
|
let { feeds, pcursor } = data;
|
|
let html = feeds
|
|
.map((e) => {
|
|
return `
|
|
<li>
|
|
<img src="${e.photo.coverUrl}" alt="">
|
|
</li>
|
|
`;
|
|
})
|
|
.toString()
|
|
.replaceAll(",", "");
|
|
|
|
document.querySelector("ul").innerHTML += html;
|
|
|
|
document.querySelectorAll("ul li").forEach((e) => {
|
|
e.onmouseover = () => {
|
|
console.log("e: ", e);
|
|
};
|
|
});
|
|
});
|
|
</script>
|
|
</html>
|