Add on change action to attachment field
This commit is contained in:
parent
04b299750d
commit
9b56dcfdfe
|
@ -8,6 +8,7 @@
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let validation
|
export let validation
|
||||||
export let extensions
|
export let extensions
|
||||||
|
export let onChange
|
||||||
|
|
||||||
let fieldState
|
let fieldState
|
||||||
let fieldApi
|
let fieldApi
|
||||||
|
@ -38,6 +39,13 @@
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleChange = e => {
|
||||||
|
fieldApi.setValue(e.detail)
|
||||||
|
if (onChange) {
|
||||||
|
onChange({ value: e.detail })
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
|
@ -55,9 +63,7 @@
|
||||||
value={fieldState.value}
|
value={fieldState.value}
|
||||||
disabled={fieldState.disabled}
|
disabled={fieldState.disabled}
|
||||||
error={fieldState.error}
|
error={fieldState.error}
|
||||||
on:change={e => {
|
on:change={handleChange}
|
||||||
fieldApi.setValue(e.detail)
|
|
||||||
}}
|
|
||||||
{processFiles}
|
{processFiles}
|
||||||
{handleFileTooLarge}
|
{handleFileTooLarge}
|
||||||
{extensions}
|
{extensions}
|
||||||
|
|
Loading…
Reference in New Issue