# 枚举处理工具集

1. 全局引入

如果你完整引入了 Void-Elem-UI, Vue.prototype 添加如下全局方法:$vutil$vutiloption 对象为枚举处理工具集。

// 函数式
const transferValue = this.$vutil.option.transformOption(
  value,
  STATUS_OPTIONS,
  options,
);
// 链式
const mapper = this.$vutil.option.enumMapper(STATUS_OPTIONS);
mapper.labelField("label");
let label = mapper.label(label);
let value = mapper.label(value);

2. 单独使用

import { vutil as $vutil } from "void-elem-ui";

// 函数式
const transferValue = $vutil.option.transformOption(
  value,
  STATUS_OPTIONS,
  options,
);
// 链式
const mapper = $vutil.option.enumMapper(STATUS_OPTIONS);
mapper.labelField("label");
let label = mapper.label(label);
let value = mapper.label(value);

3. 枚举值解析/逆向解析(函数式)

4. 枚举解析器(链式)