diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 8cd7bb628..16d4dd160 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -108,6 +108,8 @@ const CrudModelRef = ref({}); const showForm = ref(false); const splittedColumns = ref({ columns: [] }); const columnsVisibilitySkiped = ref(); +const createForm = ref(); + const tableModes = [ { icon: 'view_column', @@ -139,6 +141,14 @@ onMounted(() => { .map((c) => c.name), ...['tableActions'], ]; + createForm.value = $props.create; + if ($props.create && route?.query?.createForm) { + showForm.value = true; + createForm.value = { + ...createForm.value, + ...{ formInitialData: JSON.parse(route?.query?.createForm) }, + }; + } }); watch( @@ -158,7 +168,7 @@ function setUserParams(watchedParams) { if (!watchedParams) return; if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); - const filter = JSON.parse(watchedParams?.filter); + const filter = JSON.parse(watchedParams?.filter ?? '{}'); const where = filter?.where; const order = filter?.order; @@ -598,14 +608,14 @@ defineExpose({ - {{ create.title }} + {{ createForm.title }}