Skip to content

BaseStatus 状态

使用场景

表格显示状态字段

ts
export const OrderStatus = {
  未下单: { value: 0, theme: 'default' },
  已下单: { value: 1, theme: 'primary' },
  已配送: { value: 2, theme: 'primary' },
  已签收: { value: 3, theme: 'success' },
  退货中: { value: 4, theme: 'danger' },
};
html
<h3>值时状态str</h3>
<base-status value="进行中" />

<h3>值时val + options</h3>
<base-status
  :value="status"
  :options="[
      { label: '未开始', value: 0, theme: 'default' },
      { label: '进行中', value: 1, theme: 'primary' },
      { label: '已完成', value: 2, theme: 'success' },
      { label: '失败', value: 3, theme: 'danger' },
    ]"
  @click="onStatusClick"
/>

<h3>值时val + enum</h3>
<base-status
  :value="orderStatus"
  :options="OrderStatus"
  @click="onOrderStatusClick"
/>

Demo

Variant

API

参数说明类型默认值版本
options设置选项BaseStatusOption-
theme主题色,设置优先级最高,没有是 'primary''primary' | 'success' | 'danger' | 'default'-
value值,没有 options 是 labelstring | number-
variant形变,'dot' | 'fill' | 'outline' | 'dashed' | 'text''dot'

BaseStatusOption 属性

参数说明类型默认值版本
label标签string-
theme主题'primary' | 'success' | 'danger' | 'default'-
valuestring | number-