Add default value for number field

This commit is contained in:
Andrew Kingston 2021-08-04 14:33:37 +01:00
parent 12d5ccb3a7
commit bbf9f42555
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)}
/>