v0.9.5
This commit is contained in:
commit
6aa66cfa49
286 files changed
+19274
No files matched your search
@@ -0,0 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, type Component } from 'vue';
|
||||
import { blockComponents } from './components';
|
||||
import type { Block } from './support';
|
||||
|
||||
// Draws the blocks of a page (`Blocks::for()` as a prop): one component per type. `components` replaces or adds a type of the site;
|
||||
// a type without a component draws nothing.
|
||||
const props = defineProps<{ blocks: Block[]; components?: Record<string, Component> }>();
|
||||
const map = computed(() => ({ ...blockComponents, ...(props.components ?? {}) }));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-for="block in blocks" :key="block.id">
|
||||
<component :is="map[block.type]" v-if="map[block.type]" :data="block.data" :style="block.style" :items="block.items" />
|
||||
</template>
|
||||
</template>
|
||||
Reference in new issue
Block a user