diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index dca30516f..d6b35d4da 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( @@ -160,7 +170,7 @@ function setUserParams(watchedParams, watchedOrder) { if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); const filter = typeof watchedParams?.filter == 'string' - ? JSON.parse(watchedParams?.filter) + ? JSON.parse(watchedParams?.filter ?? '{}') : watchedParams?.filter; const where = filter?.where; const order = watchedOrder ?? filter?.order; @@ -615,14 +625,14 @@ defineExpose({ - {{ create.title }} + {{ createForm.title }}