Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Svelteで作るページビルダー

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.
Avatar for maku. maku.
December 07, 2019

 Svelteで作るページビルダー

Avatar for maku.

maku.

December 07, 2019

More Decks by maku.

Other Decks in Programming

Transcript

  1. <template> <main class=”index”> <h1>ݟग़͠</h1> <p>ຊจ</p> <Block :content=”content”/> </main> </template> <script>

    import Block from ‘...’ export default { components: { Block }, data() { return { content: ‘’ }... Vue.js
  2. <template> <main class=”index”> <h1>ݟग़͠</h1> <p>ຊจ</p> <Block :content=”content”/> </main> </template> <script>

    import Block from ‘...’ export default { components: { Block }, data() { return { content: ‘’ }... ɾςϯϓϨʔτλάͷ௚Լʹ1ͭͷࢠཁૉ ɾexport default { … } ɾϓϩύςΟΛdataؔ਺Ͱఆٛ ɾ࢖༻ίϯϙʔωϯτΛ͢΂ͯએݴ etc... Vue.js
  3. <h1>ݟग़͠</h1> <p>ຊจ</p> <Block {content}/> <script> import Block from ‘...’; export

    let content; </script> Svelte ɾ࠷௿ݶͷHTMLλά ɾίϯϙʔωϯτ͸import͢Δ͚ͩ ɾϓϩύςΟ͸ม਺ͱͯ͠એݴ͢Δ͚ͩ
  4. {#if show} <Preview></Preview> {/if} <script> import Preview from '...'; export

    let componentId; let show = true; $: ((id) => { show = false; setTimeout(() => show = true, 0); })(componentId); </script> Svelte
  5. {#if show} <Preview></Preview> {/if} <script> import Preview from '///'; export

    let componentId; let show = true; $: ((id) => { show = false; setTimeout(() => show = true, 0); })(componentId); </script> Svelte ɾҙਤͨ͠λΠϛϯάͰॳظԽͰ͖ͣɺ ɹҰ෦ແཧ΍Γ࠶ඳը͢Δඞཁ͕͋ͬͨ ɾDOMΛ·Δ͝ͱॻ͖׵͑Δॲཧ͕࿈ଓ ɹͨ͠ͷಈ͖͕Πέͯͳ͍