mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-09 09:41:37 +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">
|
<script lang="ts">
|
||||||
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
export let value: string;
|
export let value: string;
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
const handleKeyDown = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
dispatch('click');
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input on:click type="submit" {value} />
|
<input on:click type="submit" {value} />
|
||||||
|
|
||||||
|
<svelte:window on:keydown={handleKeyDown} />
|
||||||
|
|
||||||
<style lang="postcss">
|
<style lang="postcss">
|
||||||
input {
|
input {
|
||||||
@apply bg-sspsBlue hover:bg-sspsBlueDark
|
@apply bg-sspsBlue hover:bg-sspsBlueDark
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue