schlechtenburg/src/App.tsx

44 lines
930 B
TypeScript
Raw Normal View History

2020-05-20 14:21:08 +00:00
import {
defineComponent,
reactive,
watchEffect,
} from '@vue/composition-api';
import Schlechtenburg from '@components/Schlechtenburg';
2020-05-25 21:10:21 +00:00
import { BlockData } from './components/TreeElement';
2020-05-20 14:21:08 +00:00
import './App.scss';
export default defineComponent({
name: 'App',
setup() {
2020-05-20 17:12:51 +00:00
const block = reactive({
2020-05-24 15:33:25 +00:00
name: 'sb-layout',
blockId: `${+(new Date())}`,
data: {
orientation: 'vertical',
children: [],
},
2020-05-25 21:10:21 +00:00
}) as BlockData;
2020-05-20 14:21:08 +00:00
2020-05-25 21:10:21 +00:00
return () => (
2020-05-20 14:21:08 +00:00
<div id="app">
2020-05-25 21:10:21 +00:00
<Schlechtenburg
block={block}
{...{
on: {
update: (newBlock: BlockData) => {
block.name = newBlock.name;
block.blockId = newBlock.blockId;
block.data = newBlock.data;
},
},
}}
/>
2020-05-20 14:21:08 +00:00
2020-05-25 21:10:21 +00:00
<pre><code>{JSON.stringify(block, null, 2)}</code></pre>
2020-05-20 14:21:08 +00:00
</div>
);
},
});