Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | <template>
<v-row class="py-2">
<v-col class="d-flex flex-column">
<v-row class="h-0 overflow-auto">
<v-col
v-for="(x, key) in newsAll"
:key="key"
xl=3
lg=4
md=12
sm=12
xs=12
cols=12
class="d-flex pa-0 flex-column "
>
<NewsCard :news="x" class="ma-1"/>
</v-col>
</v-row>
<v-row class="flex-grow-0 ">
<v-col class="pa-0" >
<v-pagination
density="compact"
v-model="page"
:length="visiblePage"
:total-visible="7"
@update:modelValue="loadNewsAll"
>
<template v-slot:item="item">
<v-btn icon density="compact"
:color="item.isActive?'more_details_btn':'grey-ligten-3'"
@click="pager(item.page)"
>{{ item.page }}</v-btn>
</template>
</v-pagination>
</v-col>
<v-col class="flex-grow-0 py-0 " >
<v-select
style="width:53px"
hide-details
density="compact"
hide-selected
v-model="countpage"
rounded
variant="underlined"
:items="[8, 16, 24, 32, 40]"
@update:modelValue="loadNewsAll"
/>
</v-col>
</v-row>
</v-col>
</v-row>
</template>
<script>
import { ref } from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { useRoute } from 'vue-router'
import NewsCard from './UI/NewsCard.vue'
export default {
components: {
NewsCard
},
setup(){
const newsAll=ref([])
const countetnews = ref(0)
const page = ref(1)
const countpage = ref(8)
const route = useRoute()
const visiblePage = ref(0)
const loadNewsAll = () => {
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path.slice(1)}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
newsAll.value= result.data.result
countetnews.value = result.data.countpage/countpage.value
visiblePage.value = countetnews.value <= 1 ? 1 : Math.ceil(countetnews.value)
}
)
}
loadNewsAll()
const pager=(val)=>{
page.value=Number(val)
loadNewsAll()
}
return {
newsAll,
pager,
page,
countpage,
visiblePage,
loadNewsAll,
}
}
}
</script>
<style>
</style> |