diff --git a/.gitignore b/.gitignore
index a855384..599da9e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
+pnpm-lock.yaml
node_modules
dist
diff --git a/src/components/Table/index.vue b/src/components/Table/index.vue
index 949a735..1aaa21b 100644
--- a/src/components/Table/index.vue
+++ b/src/components/Table/index.vue
@@ -12,7 +12,7 @@
hide-pagination
>
-
+
@@ -25,8 +25,11 @@
@@ -41,54 +44,52 @@
import has from "lodash/has";
export default {
+ name: "Table",
props: {
columns: {
type: Array,
required: true,
- validator: (value) => value.some((item) => has(item, ["name", "label"])),
+ validator: (value) =>
+ Array.isArray(value) &&
+ value.every((col) => has(col, "name") && has(col, "label")),
},
rows: {
type: Array,
required: true,
- validator: (value) => value.some((item) => has(item, ["name", "label"])),
+ validator: (value) => Array.isArray(value),
},
rowName: {
type: String,
- required: false,
default: "name",
},
rowKey: {
type: String,
- required: false,
default: "id",
},
- title: {
- type: String,
- required: false,
- },
+ title: String,
loading: {
type: Boolean,
- required: false,
default: false,
},
pagination: {
type: Object,
required: false,
default: {
- sortBy: "desc",
- descending: false,
- currentPage: 1,
+ page: 1,
+ direction: "desc",
+ perPage: 10,
+ total: 10,
totalPages: 1,
- totalItems: 10,
+ hasNext: false,
+ hasPrev: false,
},
},
},
- setup(props) {
- return {
- columns: props.columns,
- rows: props.rows,
- rowKey: props.rowKey,
- };
+ emits: ["update:pagination"],
+ methods: {
+ updatePagination(page) {
+ this.$emit("update:pagination", { ...this.pagination, page });
+ },
},
};
diff --git a/src/routes/videos/index.vue b/src/routes/videos/index.vue
index 7d5f0b7..a6d4647 100644
--- a/src/routes/videos/index.vue
+++ b/src/routes/videos/index.vue
@@ -18,7 +18,7 @@
@@ -29,7 +29,9 @@
:columns="columns"
:rows="rows"
:pagination="pagination"
+ :loading="loading"
row-key="id"
+ @update:pagination="updatePagination"
>