VEUI

VEUI on GitHub
Play!中文

Step

Examples

Style variants

Available ui prop values: s / m / dot / vertical / label-vertical.

The stateless prop can be used to switch to a pure display style without state.

Edit this demo on GitHubEdit
<template>
<article>
  <section class="settings">
    <veui-label>
      Current step    <veui-number-input
        v-model="current"
        ui="s"
        :min="1"
        :max="steps.length"
        :step="1"
      />
    </veui-label>
    <veui-radio-button-group
      v-model="style"
      ui="s"
      :items="styles"
    />
    <veui-radio-button-group
      v-model="size"
      ui="s"
      :items="sizes"
    />
    <veui-radio-button-group
      v-model="direction"
      ui="s"
      :items="directions"
    />
    <veui-checkbox
      v-model="stateless"
      ui="s"
    >
      Stateless
    </veui-checkbox>
  </section>
  <section>
    <veui-steps
      :ui="ui"
      :steps="steps"
      :current="current - 1"
      :stateless="stateless"
    />
  </section>
</article>
</template>

<script>
import { Steps, Label, NumberInput, RadioButtonGroup, Checkbox } from 'veui'

export default {
  components: {
    'veui-steps': Steps,
    'veui-label': Label,
    'veui-number-input': NumberInput,
    'veui-radio-button-group': RadioButtonGroup,
    'veui-checkbox': Checkbox
  },
  data () {
    return {
      current: 1,
      size: 'm',
      direction: '',
      style: 'normal',
      sizes: [
        {
          label: 's',
          value: 's'
        },
        {
          label: 'm',
          value: 'm'
        }
      ],
      stateless: false,
      directions: [
        {
          label: 'vertical',
          value: 'vertical'
        },
        {
          label: 'label-vertical',
          value: 'label-vertical'
        },
        {
          label: 'default',
          value: ''
        }
      ],
      styles: [
        {
          label: 'normal',
          value: 'normal'
        },
        {
          label: 'dot',
          value: 'dot'
        }
      ],
      steps: [
        { label: 'Step 1', desc: '填写信息' },
        { label: 'Step 2', desc: '验证身份' },
        { label: 'Step 3', desc: '注册成功' }
      ]
    }
  },
  computed: {
    ui () {
      return [
        this.style,
        this.size,
        this.style === 'dot' && this.direction === ''
          ? 'label-vertical'
          : this.direction
      ].join(' ')
    }
  }
}
</script>

<style lang="less" scoped>
.settings {
  display: flex;
  margin-bottom: 32px;
  gap: 16px;
  align-items: center;
}
</style>

Step status

The step status can be automatically defined by setting the status of the steps property data item. If the step is in error, it can be set to error.

Current step

Edit this demo on GitHubEdit
<template>
<article>
  <section>
    <h4>Current step</h4>
    <veui-number-input
      v-model="current"
      :min="1"
      :max="steps.length"
      :step="1"
    />
  </section>
  <section>
    <veui-steps
      :steps="steps"
      :current="current - 1"
    />
  </section>
</article>
</template>

<script>
import { Steps, NumberInput } from 'veui'

export default {
  components: {
    'veui-steps': Steps,
    'veui-number-input': NumberInput
  },
  data () {
    return {
      current: 2,
      steps: [
        { label: 'Step 1', desc: '填写信息' },
        { label: 'Step 2', desc: '验证身份', status: 'error' },
        { label: 'Step 3', desc: '注册成功' }
      ]
    }
  }
}
</script>

<style lang="less" scoped>
h4 {
  margin: 0 0 10px;
}

section {
  margin-bottom: 10px;
}

section + section {
  margin-top: 20px;
}
</style>

API

Props

NameTypeDefaultDescription
uistring-

Predefined styles.

ValueDescription
sSmall size style.
mMedium size style.
dotDot style.
verticalVertical style.
label-verticalText vertical style.
stepsArray-

Step data source. The type is { label, desc, to, status }.

NameType
labelstringStep title.
descstringStep description.
tostring | ObjectStep link. Type is the same as the to property of the Link component.
statusstringStep status. The optional values are default and error.
currentnumber-The index value of the current step.
statelessbooleanfalseWhether to use a pure display style without state.

Slots

NameDescription
default

The content of the entire step item.

Default content: index/completion icon, step title, description, and other content.

NameTypeDescription
labelstringStep title. The same as the label field of the project in steps property.
descstringStep description. The same as the desc field of the project in steps property.
tostring | ObjectStep link. The same as the to field of the project in steps property.
statusstringStep status. The same as the status field of the project in steps property.
indexnumberStep index value.

In addition, properties other than those described above in the steps data item will also be automatically bound to the slot parameters through v-bind.

indexThe content of the index part. By default, the index starts from 1, completed steps display a completion icon, and error steps display an error icon. It is located inside the default slot, and the slot parameters are the same as those of the default slot.
labelThe content of the step title. By default, it displays the label field of the project in steps. It is located inside the default slot, and the slot parameters are the same as those of the default slot.
descThe content of the step description. By default, it displays the desc field of the project in steps. It is located inside the default slot, and the slot parameters are the same as those of the default slot.

Events

NameDescription
clickTriggered after any step is clicked. The callback parameter is (index: number, event: Event). index is the index value of the clicked step, and event is the corresponding native event object.

Icons

NameDescription
successCompleted step.
errorError step.
Edit this page on GitHubEdit
© Baidu, Inc. 2024