mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-24 12:35:31 +00:00
Merge pull request #114 from EETagent/handle_for_submit_buttons
(frontend) click event on enter for submit buttons
This commit is contained in:
commit
978aea863a
1 changed files with 12 additions and 0 deletions
|
|
@ -1,9 +1,21 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let value: string;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Enter') {
|
||||
dispatch('click');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<input on:click type="submit" {value} />
|
||||
|
||||
<svelte:window on:keydown={handleKeyDown} />
|
||||
|
||||
<style lang="postcss">
|
||||
input {
|
||||
@apply bg-sspsBlue hover:bg-sspsBlueDark
|
||||
|
|
|
|||
Loading…
Reference in a new issue