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