Skip to content

DynamicInput

Add/remove/edit for array fields; each row reuses the oas-input component, supporting both controlled and uncontrolled modes.

Basic Usage

Add/remove list

model-value is a JSON array attribute (also assignable via property); each row has an input + remove button, with an "添加" button at the end.

Default Value

default-value

New rows start with default-value as their initial value.

min / max Boundaries

min=2 fills up rows

Under min, rows are auto-filled; when min is reached, remove buttons are disabled.

max=3 disables adding

When max is reached, the "添加" button is disabled; an over-long model-value is truncated automatically.

Disabled

disabled

Events

Change events

Listen to oas-change (detail: { value: string[] }):

API

Attributes

AttributeDescriptionTypeDefault
default-valueDefault value for new rowsstring
disabledDisabled (row inputs + buttons)boolean
maxMaximum rows; truncates when overstring
minMinimum rows; auto-fills when belowstring0
model-valueString array (property or JSON)string[][]

Events

EventDescription
oas-changeDispatched after add/remove/edit, detail: { value }

Controlled: listen to oas-change and set the modelValue property (or the model-value attribute) to write back.