tweak examples

pull/2199/head
Richard Harris 6 years ago
parent 830fb1ea49
commit 23eeddef66

@ -2,4 +2,4 @@
let name = 'world'; let name = 'world';
</script> </script>
<h1>Hello {name.toUpperCase()}!</h1> <h1>Hello {name}!</h1>

@ -3,4 +3,5 @@
let name = 'Rick Astley'; let name = 'Rick Astley';
</script> </script>
<!-- {src} is short for src={src} -->
<img {src} alt="{name} dancing"> <img {src} alt="{name} dancing">

@ -6,4 +6,4 @@
} }
</style> </style>
<p>This is a paragraph.</p> <p>Styled!</p>

@ -10,5 +10,5 @@
} }
</style> </style>
<p>This is a paragraph.</p> <p>These styles...</p>
<Nested/> <Nested/>

@ -1 +1 @@
<p>This is another paragraph.</p> <p>...don't affect this element</p>

@ -1,5 +1,5 @@
<script> <script>
let string = `this string contains some <strong>HTML!!!</strong>`; let string = `here's some <strong>HTML!!!</strong>`;
</script> </script>
<p>{@html string}</p> <p>{@html string}</p>

@ -1,3 +1,3 @@
{ {
"title": "Assignments" "title": "Reactive assignments"
} }

@ -1,6 +1,9 @@
<script> <script>
let count = 0; let count = 1;
// the `$:` means 're-run whenever these values change'
$: doubled = count * 2; $: doubled = count * 2;
$: quadrupled = doubled * 2;
function handleClick() { function handleClick() {
count += 1; count += 1;
@ -8,7 +11,8 @@
</script> </script>
<button on:click={handleClick}> <button on:click={handleClick}>
Clicked {count} {count === 1 ? 'time' : 'times'} Count: {count}
</button> </button>
<p>{count} doubled is {doubled}</p> <p>{count} * 2 = {doubled}</p>
<p>{doubled} * 2 = {quadrupled}</p>

@ -1,3 +1,3 @@
{ {
"title": "Declarations" "title": "Reactive declarations"
} }

@ -1,3 +1,3 @@
{ {
"title": "Statements" "title": "Reactive statements"
} }

@ -1,3 +1,3 @@
{ {
"title": "This" "title": "bind:this={canvas}"
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Loading…
Cancel
Save