mirror of https://github.com/sveltejs/svelte
parent
bb147ea594
commit
876539f78b
@ -1,17 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import { counter } from './stores.js';
|
import { count } from './stores.js';
|
||||||
import Incrementer from './Incrementer.svelte';
|
import Incrementer from './Incrementer.svelte';
|
||||||
import Decrementer from './Decrementer.svelte';
|
import Decrementer from './Decrementer.svelte';
|
||||||
import Resetter from './Resetter.svelte';
|
import Resetter from './Resetter.svelte';
|
||||||
|
|
||||||
let counterValue;
|
let countValue;
|
||||||
|
|
||||||
const unsubscribe = counter.subscribe(value => {
|
const unsubscribe = count.subscribe(value => {
|
||||||
counterValue = value;
|
countValue = value;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The counter is {counterValue}</h1>
|
<h1>The count is {countValue}</h1>
|
||||||
|
|
||||||
<Incrementer/>
|
<Incrementer/>
|
||||||
<Decrementer/>
|
<Decrementer/>
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const counter = writable(0);
|
export const count = writable(0);
|
||||||
@ -1,11 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { counter } from './stores.js';
|
import { count } from './stores.js';
|
||||||
import Incrementer from './Incrementer.svelte';
|
import Incrementer from './Incrementer.svelte';
|
||||||
import Decrementer from './Decrementer.svelte';
|
import Decrementer from './Decrementer.svelte';
|
||||||
import Resetter from './Resetter.svelte';
|
import Resetter from './Resetter.svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The counter is {$counter}</h1>
|
<h1>The count is {$count}</h1>
|
||||||
|
|
||||||
<Incrementer/>
|
<Incrementer/>
|
||||||
<Decrementer/>
|
<Decrementer/>
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const counter = writable(0);
|
export const count = writable(0);
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { counter } from './stores.js';
|
import { count } from './stores.js';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The counter is {$counter}</h1>
|
<h1>The count is {$count}</h1>
|
||||||
|
|
||||||
<button on:click={counter.increment}>+</button>
|
<button on:click={count.increment}>+</button>
|
||||||
<button on:click={counter.decrement}>-</button>
|
<button on:click={count.decrement}>-</button>
|
||||||
<button on:click={counter.reset}>reset</button>
|
<button on:click={count.reset}>reset</button>
|
||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const counter = writable(0);
|
export const count = writable(0);
|
||||||
@ -1,17 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import { counter } from './stores.js';
|
import { count } from './stores.js';
|
||||||
import Incrementer from './Incrementer.svelte';
|
import Incrementer from './Incrementer.svelte';
|
||||||
import Decrementer from './Decrementer.svelte';
|
import Decrementer from './Decrementer.svelte';
|
||||||
import Resetter from './Resetter.svelte';
|
import Resetter from './Resetter.svelte';
|
||||||
|
|
||||||
let counterValue;
|
let countValue;
|
||||||
|
|
||||||
counter.subscribe(value => {
|
count.subscribe(value => {
|
||||||
counterValue = value;
|
countValue = value;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The counter is {counterValue}</h1>
|
<h1>The count is {countValue}</h1>
|
||||||
|
|
||||||
<Incrementer/>
|
<Incrementer/>
|
||||||
<Decrementer/>
|
<Decrementer/>
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const counter = writable(0);
|
export const count = writable(0);
|
||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const counter = writable(0);
|
export const count = writable(0);
|
||||||
@ -1,11 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { counter } from './stores.js';
|
import { count } from './stores.js';
|
||||||
import Incrementer from './Incrementer.svelte';
|
import Incrementer from './Incrementer.svelte';
|
||||||
import Decrementer from './Decrementer.svelte';
|
import Decrementer from './Decrementer.svelte';
|
||||||
import Resetter from './Resetter.svelte';
|
import Resetter from './Resetter.svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The counter is {$counter}</h1>
|
<h1>The count is {$count}</h1>
|
||||||
|
|
||||||
<Incrementer/>
|
<Incrementer/>
|
||||||
<Decrementer/>
|
<Decrementer/>
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const counter = writable(0);
|
export const count = writable(0);
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { counter } from './stores.js';
|
import { count } from './stores.js';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The counter is {$counter}</h1>
|
<h1>The count is {$count}</h1>
|
||||||
|
|
||||||
<button on:click={counter.increment}>+</button>
|
<button on:click={count.increment}>+</button>
|
||||||
<button on:click={counter.decrement}>-</button>
|
<button on:click={count.decrement}>-</button>
|
||||||
<button on:click={counter.reset}>reset</button>
|
<button on:click={count.reset}>reset</button>
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { counter } from './stores.js';
|
import { count } from './stores.js';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The counter is {$counter}</h1>
|
<h1>The count is {$count}</h1>
|
||||||
|
|
||||||
<button on:click={counter.increment}>+</button>
|
<button on:click={count.increment}>+</button>
|
||||||
<button on:click={counter.decrement}>-</button>
|
<button on:click={count.decrement}>-</button>
|
||||||
<button on:click={counter.reset}>reset</button>
|
<button on:click={count.reset}>reset</button>
|
||||||
Loading…
Reference in new issue