${_data[i].title}
${_data[i].description}
查看详情>>
${_data[i].day}
${_data[i].yea_month}
`
}
_total = data.meta.pagination.total;
pageCount = data.meta.pagination.total_pages
$('.news-lists').append(_item)
console.log('_total', _total)
console.log('pageCount', pageCount)
console.log(data)
}
})
}
function initPagination() {
$(".pages-div").pagination({
totalData: _total,
pageCount: pageCount,
showData: 10,
coping: true,
callback: function(api) {
$('.news-lists').empty()
$('html, body').animate({scrollTop:300},500)
getNews(api.getCurrent(), _state)
}
});
}
$('.news-state').click(function() {
$(this).addClass("news-active")
$(this).siblings().removeClass("news-active")
const _state = $(this).attr('data-state')
changeState(_state)
initPagination()
// console.log(_state)
})
var changeState = function(state) {
console.log(state)
_state = state;
$('.news-lists').empty()
$('html, body').animate({scrollTop:300},500)
getNews(1, state)
}
function slideList() {
const _params = {
include:'class',
page: 1,
per_page: 10,
class: 'news'
}
$.ajax({
url: _url + 'api/articles',
method: 'get',
// async: false,
data: _params,
success: function(data) {
const _data = data.data
let _item = ''
for(let i = 0; i < _data.length; i++) {
_item += `
${_data[i].title}
`
}
$('.swiper-wrapper').append(_item)
var swiper = new Swiper('.swiper-container', {
slidesPerView: 4,
// spaceBetween: 10,
slidesPerGroup: 4,
loop: true,
// loopFillGroupWithBlank: true,
direction : 'vertical',
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
}
})
}
})