index.vue
1.96 KB
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
<template>
<div class="go-items-list">
<n-grid :x-gap="20" :y-gap="20" cols="2 s:2 m:3 l:4 xl:4 xxl:4" responsive="screen">
<n-grid-item v-for="(item, index) in list" :key="item.id">
<project-items-card :cardData="item" @resize="resizeHandle" @delete="deleteHandle($event, index)"
@edit="editHandle"></project-items-card>
</n-grid-item>
</n-grid>
<div class="list-pagination">
<n-pagination :item-count="10" :page-sizes="[10, 20, 30, 40]" show-size-picker />
</div>
</div>
<project-items-modal-card v-if="modalData" :modalShow="modalShow" :cardData="modalData" @close="closeModal"
@edit="editHandle"></project-items-modal-card>
</template>
<script setup lang="ts">
import { ProjectItemsCard } from '../ProjectItemsCard/index'
import { ProjectItemsModalCard } from '../ProjectItemsModalCard/index'
import { icon } from '@/plugins'
import { useModalDataInit } from './hooks/useModal.hook'
import { useDataListInit } from './hooks/useData.hook'
import { getDataViewList } from "@/api/external/contentSave/content";
import { onMounted, ref } from "vue";
// THINGS_KIT
import { ChartList } from '../../index.d'
const { CopyIcon, EllipsisHorizontalCircleSharpIcon } = icon.ionicons5
const { deleteHandle } = useDataListInit()
const { modalData, modalShow, closeModal, resizeHandle, editHandle } = useModalDataInit()
// THINGS_KIT
const list = ref<ChartList>([])
onMounted(async () => {
try {
const { items } = await getDataViewList({ page: 1, pageSize: 10 })
list.value = items
} catch (error) {
console.log(error)
}
})
</script>
<style lang="scss" scoped>
$contentHeight: 250px;
@include go('items-list') {
display: flex;
flex-direction: column;
justify-content: space-between;
min-height: calc(100vh - #{$--header-height} * 2 - 2px);
.list-content {
position: relative;
height: $contentHeight;
}
.list-pagination {
display: flex;
justify-content: flex-end;
margin-top: 20px;
}
}
</style>