schlechtenburg/src/components/internal/BlockPicker.tsx

29 lines
572 B
TypeScript
Raw Normal View History

2020-05-20 14:21:08 +00:00
import { defineComponent } from '@vue/composition-api';
2020-05-24 15:33:25 +00:00
import { useDynamicComponents } from './TreeElement';
2020-05-20 14:21:08 +00:00
export default defineComponent({
2020-05-24 15:33:25 +00:00
props: {},
2020-05-20 14:21:08 +00:00
setup(props) {
2020-05-24 15:33:25 +00:00
const { customBlocks } = useDynamicComponents(props.components || {});
2020-05-20 14:21:08 +00:00
return {
2020-05-24 15:33:25 +00:00
customBlocks,
2020-05-20 14:21:08 +00:00
};
},
render() {
return (
2020-05-24 15:33:25 +00:00
<div class="sb-block-picker">
2020-05-20 14:21:08 +00:00
<component
class="sb-main"
v-for="child in children"
:key="child.id"
:is="getComponent(child.name)"
v-bind="child"
/>
</div>
);
},
});