Files
ClassContent/项目合集/最新写真app/fontend/js/page/index.js
2025-03-16 23:01:07 +08:00

58 lines
1.1 KiB
JavaScript

let mySwiper = null
// 每一个页面都应该有一个init方法
// 用来做初始化
const init = async () => {
footer()
getTagRecommend()
getHomeBanner()
getHomeHot()
getHomeList()
}
const getHomeBanner = async () => {
innerMaps(
".swiper-wrapper",
await homeBanner(),
v => `<div class="swiper-slide">
<img src="${v.src}" alt="">
</div>`
)
initSwiper();
}
const getTagRecommend = async () => {
innerMaps(
".recommend-tag",
await tagRecommend(),
v => `
<li>
<a href="">
<div class="title">${v.short_title}</div>
<div class="desc">${v.title}</div>
</a>
</li>
`
)
}
const getHomeHot= async () => item(".roll ul",await homeHot())
const getHomeList = async () => item(".random ul", await homeList())
const initSwiper = () => {
mySwiper = new Swiper('.banner', {
loop: true, // 循环模式选项
// 如果需要分页器
pagination: {
el: '.swiper-pagination',
},
})
}
init()