schlechtenburg/src/components/Schlechtenburg.tsx

43 lines
811 B
TypeScript
Raw Normal View History

2020-05-20 14:21:08 +00:00
import {
defineComponent,
computed,
reactive,
} from '@vue/composition-api';
2020-05-20 17:12:51 +00:00
import { model, useDynamicBlocks } from '@components/TreeElement';
2020-05-20 14:21:08 +00:00
export default defineComponent({
name: 'schlechtenburg-main',
model,
props: {
2020-05-20 17:12:51 +00:00
block: { type: Object, required: true },
2020-05-20 14:21:08 +00:00
},
2020-05-20 17:12:51 +00:00
setup(props, context) {
const { getBlock } = useDynamicBlocks(context);
2020-05-20 14:21:08 +00:00
return {
2020-05-20 17:12:51 +00:00
getBlock,
2020-05-20 14:21:08 +00:00
};
},
render() {
2020-05-20 17:12:51 +00:00
const Block = this.getBlock(this.block.name);
console.log(this.name, Block);
2020-05-20 14:21:08 +00:00
return (
<Component
class="sb-main"
user-components={this.components}
2020-05-20 17:12:51 +00:00
data={this.block.data}
id={this.block.id}
2020-05-20 14:21:08 +00:00
{...{
on: {
2020-05-20 17:12:51 +00:00
blockUpdate: (block) => this.$emit('block-update', block),
2020-05-20 14:21:08 +00:00
},
}}
/>
);
},
});