mirror of https://github.com/sveltejs/svelte
parent
b68144cc79
commit
ea5e6ee0cf
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
let name = 'world';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h1>Hello {name.toUpperCase()}!</h1>
|
@ -0,0 +1,6 @@
|
|||||||
|
<script>
|
||||||
|
let src = 'tutorial/image.gif';
|
||||||
|
let name = 'Rick Astley';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<img {src} alt="{name} dancing">
|
@ -0,0 +1,9 @@
|
|||||||
|
<style>
|
||||||
|
p {
|
||||||
|
color: purple;
|
||||||
|
font-family: 'Comic Sans MS';
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<p>This is a paragraph.</p>
|
@ -0,0 +1,14 @@
|
|||||||
|
<script>
|
||||||
|
import Nested from './Nested.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p {
|
||||||
|
color: purple;
|
||||||
|
font-family: 'Comic Sans MS';
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<p>This is a paragraph.</p>
|
||||||
|
<Nested/>
|
@ -0,0 +1 @@
|
|||||||
|
<p>This is another paragraph.</p>
|
@ -0,0 +1,14 @@
|
|||||||
|
<script>
|
||||||
|
let count = 0;
|
||||||
|
$: doubled = count * 2;
|
||||||
|
|
||||||
|
function handleClick() {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={handleClick}>
|
||||||
|
Clicked {count} {count === 1 ? 'time' : 'times'}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<p>{count} doubled is {doubled}</p>
|
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
|
function handleClick() {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={handleClick}>
|
||||||
|
Clicked {count} {count === 1 ? 'time' : 'times'}
|
||||||
|
</button>
|
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
|
$: if (count >= 10) {
|
||||||
|
alert(`count is dangerously high!`);
|
||||||
|
count = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClick() {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={handleClick}>
|
||||||
|
Clicked {count} {count === 1 ? 'time' : 'times'}
|
||||||
|
</button>
|
Loading…
Reference in new issue