Skip to content

GradientEditorBar ​

GradientEditorBar to komponent przeciąganego paska używany wewnątrz edytorów gradientu.

Właściwości ​

PropDefaultType
stops*
Bieżące punkty gradientu.
—GradientStop[]
activeStopIndex*
Indeks aktywnego punktu.
—number
barBackground*
Wartość CSS background dla paska.
—string

Zdarzenia ​

EventPayloadDescription
selectStop
Emitowane po wybraniu punktu.
index: numberEmitowane po wybraniu punktu.
dragStop
Emitowane podczas przeciągania punktu.
index: number, position: numberEmitowane podczas przeciągania punktu.

Sloty ​

SlotPropsDescription
default
Pełny kontrakt renderowania paska gradientu.
stan paska + funkcje przeciąganiaPełny kontrakt renderowania paska gradientu.

Właściwości slotu domyślnego ​

ts
{
  stops: GradientStop[]
  activeStopIndex: number
  barBackground: string
  barRef: (el: unknown) => void
  onStopPointerDown: (index: number, event: PointerEvent) => void
  onPointerMove: (event: PointerEvent) => void
  onPointerUp: () => void
  draggingIndex: number | null
}

Przykład ​

vue
<GradientEditorBar
  :stops="stops"
  :active-stop-index="activeStopIndex"
  :bar-background="barBackground"
  @select-stop="selectStop"
  @drag-stop="dragStop"
  v-slot="ctx"
>
  <MyGradientBar v-bind="ctx" />
</GradientEditorBar>

Zobacz też ​

Released under the MIT License.