mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 06:36:00 +00:00
use of createRef instead of not working { corrent: xxx }
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import FormFieldTemplateLarge from '../modals/FormFieldTemplateLarge.svelte';
|
||||
import createRef from '../utility/createRef';
|
||||
|
||||
import keycodes from '../utility/keycodes';
|
||||
|
||||
@@ -24,15 +25,15 @@
|
||||
values,
|
||||
template,
|
||||
setFieldValue,
|
||||
submitActionRef: { current: null },
|
||||
submitActionRef: createRef(null),
|
||||
};
|
||||
|
||||
setContext(contextKey, context);
|
||||
|
||||
function handleEnter(e) {
|
||||
if (e.keyCode == keycodes.enter && context.submitActionRef.current) {
|
||||
if (e.keyCode == keycodes.enter && context.submitActionRef.get()) {
|
||||
e.preventDefault();
|
||||
context.submitActionRef.current(values);
|
||||
context.submitActionRef.get()(values);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
dispatch('click', $values);
|
||||
}
|
||||
|
||||
submitActionRef.current = () => {
|
||||
submitActionRef.set(() => {
|
||||
handleClick();
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<FormStyledButton type="submit" on:click={handleClick} {...$$props} />
|
||||
|
||||
Reference in New Issue
Block a user