12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <section class="container">
- <div class="editor">
- <textarea bind:value=text type=text></textarea>
- </div>
- <div id="jsonformatter">Unter <code>»s«</code> erreichbare Daten:</div>
- <div class="right-half">
- {#if schueler}
- {#each schueler as s (s.ID)}
- <svelte:component this={Component} s={s}/>
- {/each}
- {/if}
- </div>
- </section>
- <script>
- import svelte from 'svelte'
- import JSONFormatter from 'json-formatter-js'
- export default {
- oncreate () {
- const {schueler} = this.get()
- const formatter = new JSONFormatter(schueler[0])
- document.querySelector('#jsonformatter').appendChild(formatter.render())
- },
- data () {return {
- text: 'Hallo {s.Vorname}'
- }},
- computed: {
- Component: ({text}) => svelte.create(text)
- },
- }
- </script>
- <style>
- @import 'daten/main.css';
- /* Pattern styles */
- .container {
- display: grid;
- grid-template-columns: 1fr 2fr;
- grid-template-rows: 2fr 1fr;
- grid-gap: 10px;
- height: 90vh;
- margin-top: 10px;
- }
- .editor {
- grid-column: 1;
- grid-row: 1;
- /* position: sticky; */
- height: 90%;
- margin-left: 10px;
- }
- .right-half {
- grid-column: 2;
- grid-row-start: 1;
- grid-row-end: 3;
- }
- #jsonformatter {
- grid-column: 1;
- grid-row-start: 2;
- grid-row-end: 3;
- font-size: 10pt;
- margin-left: 10px;
- overflow: auto;
- }
- textarea {
- width: 100%;
- height: 100%;
- padding: 20px;
- border-color: #ccc;
- resize: none;
- font-size: 1.6em;
- }
- textarea:focus {
- outline: none;
- border-color: #3498db;
- }
- </style>
|