2👍
✅
You are having dulicated id for extra_image
. Thus every click on label +
is firing the first hidden file input.
To fix this, you just need to give different ids based on block_index
:
<input
:id="`extra_image_${block_index}`"
class="hidden"
name="extra_image"
type="file"
accept="image/*"
@change="add_extra_image($event)"
>
<label :for="`extra_image_${block_index}`" class="extra_image">
<span class="icon">+</span>
</label>
Source:stackexchange.com