2024-10-09 11:05:41 +00:00
|
|
|
<template>
|
2024-10-15 08:29:50 +00:00
|
|
|
<component :is="type" class="dynamic-component" :class="type.split('-')[1]" :data-name="type.split('-')[2]"></component>
|
2024-10-09 11:05:41 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-10-11 10:23:21 +00:00
|
|
|
let mod = []
|
|
|
|
// we autoload all components in form and nix-code folders
|
|
|
|
let comp = import.meta.glob('./{form,nix-code}/*.vue', { eager: true })
|
|
|
|
Object.entries(comp).forEach(([path, definition]) => {
|
|
|
|
let c = path.split('/');
|
|
|
|
const componentName = c[1]+'-'+c[2].replace(/\.\w+$/, '')
|
|
|
|
mod[componentName] = definition.default
|
|
|
|
})
|
|
|
|
|
|
|
|
// we autoload all custom components in form and nix-code custom folders
|
|
|
|
comp = import.meta.glob('../custom/components/{form,nix-code}/*.vue', { eager: true })
|
|
|
|
Object.entries(comp).forEach(([path, definition]) => {
|
|
|
|
let c = path.split('/');
|
|
|
|
const componentName = c[3]+'-'+c[4].replace(/\.\w+$/, '')
|
|
|
|
mod[componentName] = definition.default
|
|
|
|
})
|
2024-10-15 08:29:50 +00:00
|
|
|
|
2024-10-09 11:05:41 +00:00
|
|
|
export default {
|
|
|
|
|
|
|
|
components: {
|
2024-10-11 10:23:21 +00:00
|
|
|
...mod
|
2024-10-09 11:05:41 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
2024-10-10 10:45:58 +00:00
|
|
|
type: { type: String, required: true },
|
2024-10-09 11:05:41 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|