Skip to content

Commit 1875783

Browse files
committed
Added pagination.
1 parent 71fc55b commit 1875783

File tree

7 files changed

+185
-93
lines changed

7 files changed

+185
-93
lines changed

package-lock.json

Lines changed: 102 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
"@ckeditor/ckeditor5-vue": "2.0.1",
2424
"@iconicicons/vue3": "1.5.0",
2525
"@vueup/vue-quill": "1.0.0-beta.7",
26-
"@vueuse/components": "^6.7.3",
26+
"@vueuse/components": "^6.9.2",
2727
"@vueuse/core": "6.6.1",
2828
"@vueuse/integrations": "6.6.1",
2929
"@vueuse/motion": "1.6.0",
3030
"@vueuse/router": "6.6.1",
3131
"axios": "0.23.0",
3232
"color": "4.0.1",
3333
"fastcomments-vue-next": "2.0.1",
34-
"html-to-text": "^8.0.0",
34+
"html-to-text": "^8.1.0",
3535
"lodash": "4.17.21",
3636
"masonry-layout": "4.2.2",
3737
"mitt": "3.0.0",
@@ -71,8 +71,8 @@
7171
"vite": "2.6.7",
7272
"vite-plugin-fonts": "0.2.2",
7373
"vite-plugin-svg-icons": "1.0.5",
74-
"vite-plugin-windicss": "^1.4.12",
74+
"vite-plugin-windicss": "^1.7.0",
7575
"vue-loader": "16.8.1",
76-
"windicss": "^3.1.9"
76+
"windicss": "^3.4.3"
7777
}
7878
}

src/components/atomic/Card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div
33
class="
4-
shadow-lg shadow-dark-50
4+
shadow-lg
55
dark:shadow-black dark:shadow-xl
66
bg-white
77
dark:bg-dark-800
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<template>
2+
<div class="flex justify-center">
3+
<AtomicButton
4+
type="success"
5+
class="mr-2"
6+
:disabled="vModel <= 1"
7+
@click="vModel--"
8+
>
9+
<ArrowLeftIcon />
10+
Назад
11+
</AtomicButton>
12+
<AtomicButton
13+
type="success"
14+
is-small
15+
class="ml-2"
16+
:disabled="elements < perPage"
17+
@click="() => vModel++"
18+
>
19+
Вперед
20+
<ArrowRightIcon />
21+
</AtomicButton>
22+
</div>
23+
</template>
24+
25+
<script>
26+
import { defineComponent, ref, watch } from 'vue'
27+
import { useVModel } from '@vueuse/core/index'
28+
29+
export default defineComponent({
30+
name: 'Pagination',
31+
props: {
32+
perPage: {
33+
type: Number,
34+
required: true,
35+
},
36+
elements: {
37+
type: Number,
38+
required: true,
39+
},
40+
modelValue: {
41+
type: [String, Number],
42+
default: 1,
43+
},
44+
},
45+
emits: ['update:modelValue'],
46+
async setup(props, { emit }) {
47+
const vModel = useVModel(props, 'modelValue', emit)
48+
49+
watch(vModel, () => {
50+
window.scrollTo({
51+
top: 0,
52+
behavior: 'smooth',
53+
})
54+
})
55+
return {
56+
vModel,
57+
}
58+
},
59+
})
60+
</script>

0 commit comments

Comments
 (0)