pagination
This commit is contained in:
parent
c953d87eec
commit
0a29ad5b61
|
@ -23,11 +23,18 @@ const router = useRouter();
|
||||||
function openModal(selectedItem) {
|
function openModal(selectedItem) {
|
||||||
// modal.open(SearchShow, { title: "Welcome" });
|
// modal.open(SearchShow, { title: "Welcome" });
|
||||||
// isModalOpen.value = true;
|
// isModalOpen.value = true;
|
||||||
|
|
||||||
|
const slug = selectedItem._source.content.split(' ').filter((v,i)=>i<4).join('-');
|
||||||
|
|
||||||
router.push({
|
router.push({
|
||||||
name: "hadithaSearchShow",
|
name: "hadithaSearchShow",
|
||||||
params: {
|
params: {
|
||||||
id: selectedItem._id,
|
id: selectedItem._source.id,
|
||||||
slug: "no-slug",
|
slug: slug,
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
firstPage: 1,
|
||||||
|
page_count:props.total
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,10 +228,14 @@ const handlePagination = (prevNextIndicator: string) => {
|
||||||
.getRequest(url)
|
.getRequest(url)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
state.selectedItem = res.hits.hits?.[0];
|
state.selectedItem = res.hits.hits?.[0];
|
||||||
|
page_num.value = res.hits.hits[0]._source.address.page_num ?? 1;
|
||||||
})
|
})
|
||||||
.finally(() => (loading.value = false));
|
.finally(() => (loading.value = false));
|
||||||
};
|
};
|
||||||
|
const page_num = ref(1);
|
||||||
|
const handlePageChange = () => {
|
||||||
|
handlePagination(1, page_num.value);
|
||||||
|
};
|
||||||
// const localCopyTextToClipboard = (text: string) => {
|
// const localCopyTextToClipboard = (text: string) => {
|
||||||
// copyTextToClipboard(text);
|
// copyTextToClipboard(text);
|
||||||
// };
|
// };
|
||||||
|
@ -413,24 +417,24 @@ const handlePagination = (prevNextIndicator: string) => {
|
||||||
|
|
||||||
<div class="body-footer">
|
<div class="body-footer">
|
||||||
<div class="mt-5 z-2">
|
<div class="mt-5 z-2">
|
||||||
<div class="flex justify-between actions">
|
<!-- <div class="flex justify-between actions"> -->
|
||||||
<UButton
|
<!-- <UButton
|
||||||
disabled
|
disabled
|
||||||
class="similar-btn"
|
class="similar-btn"
|
||||||
icon="i-haditha-search-3"
|
icon="i-haditha-search-3"
|
||||||
label="مشابه"
|
label="مشابه"
|
||||||
color="neutral"
|
color="neutral"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
/>
|
/> -->
|
||||||
<!-- @click.prevent="goToTheSearch('similar')" -->
|
<!-- @click.prevent="goToTheSearch('similar')" -->
|
||||||
<UButton
|
<!-- <UButton
|
||||||
class="explore-btn"
|
class="explore-btn"
|
||||||
trailing-icon="i-haditha-explore"
|
trailing-icon="i-haditha-explore"
|
||||||
label="کاوش"
|
label="کاوش"
|
||||||
variant="solid"
|
variant="solid"
|
||||||
@click.prevent="goToTheChatbot"
|
@click.prevent="goToTheChatbot"
|
||||||
/>
|
/> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
<div class="flex justify-between pagination">
|
<div class="flex justify-between pagination">
|
||||||
<UButton
|
<UButton
|
||||||
@click="handlePagination('-1')"
|
@click="handlePagination('-1')"
|
||||||
|
@ -440,6 +444,27 @@ const handlePagination = (prevNextIndicator: string) => {
|
||||||
variant="soft"
|
variant="soft"
|
||||||
icon="i-haditha-chevron-right"
|
icon="i-haditha-chevron-right"
|
||||||
/>
|
/>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<span class="total-pages">{{ route.query.page_count }}</span>
|
||||||
|
<span class="mx-2">/</span>
|
||||||
|
<UInput
|
||||||
|
:disabled="loading"
|
||||||
|
color="neutral"
|
||||||
|
variant="outline"
|
||||||
|
v-model="page_num"
|
||||||
|
@change="handlePageChange"
|
||||||
|
:ui="{
|
||||||
|
root: 'root ',
|
||||||
|
base: 'base page-number-input',
|
||||||
|
leading: 'leading',
|
||||||
|
leadingIcon: 'leadingIcon',
|
||||||
|
leadingAvatar: 'leadingAvatar',
|
||||||
|
leadingAvatarSize: 'leadingAvatarSize',
|
||||||
|
trailing: 'trailing',
|
||||||
|
trailingIcon: 'trailingIcon',
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<UButton
|
<UButton
|
||||||
@click="handlePagination('1')"
|
@click="handlePagination('1')"
|
||||||
class="next-haditha"
|
class="next-haditha"
|
||||||
|
@ -778,6 +803,15 @@ const handlePagination = (prevNextIndicator: string) => {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
color: var(--ui-color-two);
|
color: var(--ui-color-two);
|
||||||
}
|
}
|
||||||
|
.total-pages {
|
||||||
|
font-family: IRANSansX;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 100%;
|
||||||
|
letter-spacing: 0%;
|
||||||
|
text-align: right;
|
||||||
|
color: #8a92a8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user