Components

ABTest

Props

  • id: string - A unique identifier for the A/B test.
  • variants: Variant[] - An array of variant objects for the A/B test.
  • variants: Variant<TVariantValue>[] - An array of variant objects for the A/B test. Each variant object must have:
    • id: string - A unique identifier for the variant.
    • value: TVariantValue - Data associated with the variant, which can be any JSON value.

Slots

For each variant, there should be a corresponding named slot that matches the variant's id. The content of these slots will be rendered based on the A/B test result.

Example

<template>
    <ABTest id="login" :variants="[
        { id: 'variant-a', value: 'This is Variant A' },
        { id: 'variant-b', value: 'This is Variant B' },
    ]">
        <template #variant-a="{ value }">
            <button>{{ value }}</button>
        </template>
        <template #variant-b="{ value }">
            <button>{{ value }}</button>
        </template>
    </ABTest>
</template>