From 94127504ff8119e2352134608870fefdefd81373 Mon Sep 17 00:00:00 2001 From: cuigh Date: Fri, 17 Dec 2021 16:33:24 +0800 Subject: [PATCH] Fix bug --- ui/src/pages/service/Edit.vue | 8 ++++---- ui/src/utils/data-table.ts | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/src/pages/service/Edit.vue b/ui/src/pages/service/Edit.vue index c250ebe..b969c46 100644 --- a/ui/src/pages/service/Edit.vue +++ b/ui/src/pages/service/Edit.vue @@ -31,7 +31,7 @@ { - return value.every(v => v.source && v.target) + return value?.every(v => v.source && v.target) }, t('tips.mounts_rule')), configs: customRule((rule: any, value: any[]) => { - return value.every(v => v.key && v.path) + return value?.every(v => v.key && v.path) }, t('tips.files_rule')), secrets: customRule((rule: any, value: any[]) => { - return value.every(v => v.key && v.path) + return value?.every(v => v.key && v.path) }, t('tips.files_rule')), }; const mountTypeOptions = [ diff --git a/ui/src/utils/data-table.ts b/ui/src/utils/data-table.ts index c8b5051..6f9041a 100644 --- a/ui/src/utils/data-table.ts +++ b/ui/src/utils/data-table.ts @@ -1,7 +1,7 @@ import { isRef, onMounted, reactive } from "vue" import { t } from "@/locales"; -export function useDataTable(loader: Function, filter: Object | Function) { +export function useDataTable(loader: Function, filter: Object | Function, autoFetch: boolean = true) { const state = reactive({ loading: false, data: [], @@ -42,7 +42,9 @@ export function useDataTable(loader: Function, filter: Object | Function) { fetchData() } - onMounted(fetchData) + if (autoFetch) { + onMounted(fetchData) + } return { state, pagination, fetchData, changePageSize } }