-
+
{{ service.title }}
@@ -38,6 +51,21 @@
+
+
+
+
+
@@ -46,11 +74,13 @@
import { serviceOperator, IService, IServiceListResponse } from '@/operators';
import { defineComponent } from 'vue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
-import { ElForm, ElMessage } from 'element-plus';
interface IData {
services: IService[];
loading: boolean;
+ total: number | undefined;
+ limit: number;
+ page: number;
}
export default defineComponent({
name: 'ServiceList',
@@ -60,16 +90,39 @@ export default defineComponent({
data(): IData {
return {
services: [],
- loading: false
+ loading: true,
+ total: undefined,
+ limit: 8,
+ page: parseInt(this.$route.query.page?.toString() || '1')
};
},
async mounted() {
- this.loading = true;
- console.debug('start to load all services');
- serviceOperator.getAll().then(({ data: data }: { data: IServiceListResponse }) => {
- this.services = data.items;
- this.loading = false;
- });
+ this.onFetchData();
+ },
+ methods: {
+ onPageChange(page: number) {
+ this.$router.push({
+ name: this.$route.name?.toString(),
+ query: {
+ page: page
+ }
+ });
+ this.onFetchData();
+ },
+ onFetchData() {
+ this.loading = true;
+ console.debug('start to load all services');
+ serviceOperator
+ .getAll({
+ limit: this.limit,
+ offset: (this.page - 1) * this.limit
+ })
+ .then(({ data: data }: { data: IServiceListResponse }) => {
+ this.services = data.items;
+ this.total = data.count;
+ this.loading = false;
+ });
+ }
}
});
@@ -77,7 +130,7 @@ export default defineComponent({
diff --git a/src/plugins/font-awesome.ts b/src/plugins/font-awesome.ts
index 333660c2..0ab7c33e 100644
--- a/src/plugins/font-awesome.ts
+++ b/src/plugins/font-awesome.ts
@@ -1,9 +1,16 @@
import { library } from '@fortawesome/fontawesome-svg-core';
-import * as icons from '@fortawesome/free-regular-svg-icons';
+import * as iconsRegular from '@fortawesome/free-regular-svg-icons';
+import * as iconsSolid from '@fortawesome/free-solid-svg-icons';
// register all icons from font awesome
-for (const key in icons) {
+for (const key in iconsRegular) {
//@ts-ignore
- const icon = icons[key];
+ const icon = iconsRegular[key];
+ if (icon?.iconName) library.add(icon);
+}
+
+for (const key in iconsSolid) {
+ //@ts-ignore
+ const icon = iconsSolid[key];
if (icon?.iconName) library.add(icon);
}