Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <script>
  2. import Box from './Box.svelte';
  3. import C1 from './C1.svelte';
  4. import C2 from './C2.svelte';
  5. let display = "one";
  6. let value = "one";
  7.  
  8. function one() {
  9. display = "one";
  10. value = "one";
  11. }
  12.  
  13. function two() {
  14. display = "two";
  15. value = "two";
  16. }
  17.  
  18. </script>
  19.  
  20. <button on:click={one}>one</button>
  21. <button on:click={two}>two</button>
  22.  
  23. <p>value : {value}</p>
  24. <p>display : {display}</p>
  25. <Box>
  26. {#if (display=="one")}
  27. <C1/>
  28.  
  29. {:else if (display == "two")}
  30. <C2/>
  31. {:else}
  32. <p>
  33. default value
  34. </p>
  35. {/if}
  36. <hr/>
  37. <p>box footer - {value}</p>
  38.  
  39. </Box>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement