Add default value for number field

This commit is contained in:
Andrew Kingston 2021-08-04 14:33:37 +01:00
parent 1af0b1533b
commit 0fcc182f3b
1 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,11 @@
<script>
import StringField from "./StringField.svelte"
export let defaultValue
</script>
<StringField {...$$props} type="number" />
<StringField
{...$$props}
type="number"
defaultValue={isNaN(defaultValue) ? null : parseFloat(defaultValue)}
/>