first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
ul {
display: flex;
}
.tabs_title {
height: 45px;
align-items: center;
}
.tabs_title li {
margin: 0 10px;
}
.tabs_content li {
display: none;
}
.active_content {
display: block !important;
}
.active_title {
color: red;
}
</style>
<body>
<ul class="tabs_title"></ul>
<ul class="tabs_content"> </ul>
</body>
<script>
var index = 0
var tabsData = [
{
id: 1,
title: '首页',
page: 1,
content: [
{ Text: '首页的内容1' },
{ Text: '首页的内容1' },
{ Text: '首页的内容1' },
]
},
{
id: 1,
title: '首页',
page: 1,
content: [
{ Text: '首页的内容1' },
{ Text: '首页的内容1' },
{ Text: '首页的内容1' },
]
},
{
id: 1,
title: '首页',
page: 1,
content: [
{ Text: '首页的内容1' },
{ Text: '首页的内容1' },
{ Text: '首页的内容1' },
]
},
];
function renderTitle() {
tabsData.forEach((v, i) => {
$('.tabs_title').innerHTML += `<li class="${i == 0 ? 'active_title' : ""}">${v.title}</li>`;
$('.tabs_content').innerHTML += `<li class="${i == 0 ? 'active_content' : ""}">${v.title}</li>`;
})
_('tabs_title li').forEach((v, i) => {
v.onclick = () => {
index = i;
_('.tabs_title li').forEach((j, index) => {
j.classList.remove('active_title')
_('.tabs_content li')[index].classList.remove('active_content');
})
v.classList.add('active_title')
_('.tabs_content li')[index].classList.add('active_content');
renderContent();
}
})
}
function renderContent() {
_(".tabs_content li")[index].innerHTML = ""
tabsData[index].content.forEach((v) => {
_('.tabs_content li')[index].innerHTML += `<p>${v.text}</p>`
})
}
renderTitle();
renderContent();
function _(className) {
return document.querySelectorAll(className)
}
function $(className) {
return document.querySelector(className)
}
</script>
</html>