0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00
svelte/documentation/tutorial/06-bindings/13-component-bindings/app-b/App.svelte

15 lines
307 B
Svelte
Raw Normal View History

2019-03-10 20:53:01 +01:00
<script>
import Keypad from './Keypad.svelte';
let pin;
$: view = pin ? pin.replace(/\d(?!$)/g, '•') : 'enter your pin';
function handleSubmit() {
alert(`submitted ${pin}`);
}
</script>
<h1 style="color: {pin ? '#333' : '#ccc'}">{view}</h1>
2023-05-14 07:50:43 +02:00
<Keypad bind:value={pin} on:submit={handleSubmit} />