Skip to main content

AdminForthComponentDeclarationFull

AdminForthComponentDeclarationFull: object

Type declaration

file

file: string

Path to custom component which will be used to render field in the admin panel. e.g. @@/MyCustomComponent.vue

meta?

optional meta: any

Optional Meta object which will be passed to custom component as props. For example used by plugins to pass plugin options to custom components.

Example:

{
name: 'Country Flag',
virtual: true,
showIn: [AdminForthResourcePages.SHOW],
components: {
show: {
file: '@@/Flag.vue',
meta: {
flagType: 'country',
},
},
},
},
{
name: 'Team Flag',
virtual: true,
showIn: [AdminForthResourcePages.SHOW],
components: {
show: {
file: '@@/Flag.vue',
meta: {
flagType: 'team',
},
},
},
}

In Flag.vue you can access this meta object like this:

<template>
<img :src="loadFile(`@@/flags/${meta.flagType}/${meta.flagType === 'country' ? record.countryIso : record.teamCode}.png`)" />
</template>

<script setup>
import { loadFile } from '@/utils';
defineProps(['meta', 'record']);
</script>