# van-field-dict组件

此组件主要是对于部分输入内容进行数据脱敏处理

desensitization传递脱敏类型 可选值有 name,address,idCard, mobile 传递数字类型时表示展示前面几位数

desensitizationEnd后面展示多少位数

desensitizationPlaceholder中间展示多少个 *

defaultValuedesensitization有传值时,且脱敏值为空时 展示默认值

<template>
  <div>
    <van-field-dict label="姓名" v-model="value1"></van-field-dict>
    <van-field-dict label="证件号码" v-model="value2"></van-field-dict>
    <van-field-dict label="手机号" v-model="value3"></van-field-dict>
    <van-field-dict label="地址" type="textarea" v-model="value4"></van-field-dict>

    <van-field-dict label="姓名" desensitization="name" v-model="value1"></van-field-dict>
    <van-field-dict label="证件号码" desensitization="idCard" v-model="value2"></van-field-dict>
    <van-field-dict label="手机号" desensitization="mobile" v-model="value3"></van-field-dict>
    <van-field-dict label="地址" type="textarea" desensitization="address" v-model="value4"></van-field-dict>
    <van-field-dict label="前三后四" :desensitization="3" :desensitizationEnd="4" v-model="value5"></van-field-dict>
    <van-field-dict label="前三中三后四" :desensitization="3" :desensitizationPlaceholder="3" :desensitizationEnd="4" v-model="value6"></van-field-dict>
    <van-field-dict label="默认值" defaultValue="恭喜发财" desensitization="name" v-model="value7"></van-field-dict>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value1: "沈小布",
      value2: "35062418892031",
      value3: "18859661234",
      value4: "宁夏回族自治区闽宁镇涌泉村芗城路142号",
      value5: "1234567890",
      value6: "13145021314",
      value7: ""
    }
  }
}
</script>

<style>

</style>
显示代码

# Field Dict Attributes

参数 说明 类型 可选值 默认值
desensitization 数据脱敏,字符串类型时从可选值选 数字类型时表示展示前几位数 [String,Number] mobile,name,address,idCard
defaultValue 有传值时,且脱敏值为空时 展示默认值 String
desensitizationEnd 展示后面几位 Number
desensitizationPlaceholder 中间展示几个* 无值则根据实际情况渲染个数 Number
上次更新: February 19th 2022, 11:16:58