<!--脱敏文本展示组件-->
<template>
    <span :class="props.underline?'underline':''">
      <slot v-if="$slots.default"></slot>
      <template v-else-if="props.data" >
        <el-tooltip :content="props.aesDecrypt?decrypt(props.data,props.decryptKey):props.data" placement="bottom" effect="light">
          {{ desensitize(props.aesDecrypt?decrypt(props.data,props.decryptKey):props.data,props.type,props.custEvent) }}
        </el-tooltip>
      </template>
      <template v-else>&nbsp;</template>
    </span>
</template>

<script setup lang="ts">
import { decrypt,desensitize,DesensitizationType } from '@/framework/utils/standard/security.ts'

let props = defineProps({
  data: { type: String, default: '', },//展示数据
  aesDecrypt:{type:Boolean,default: true},//是否aes解密
  decryptKey:{type:String,default: ''},//自定义密钥
  underline:{type:Boolean,default: false},//是否需要下划线
  type:DesensitizationType,//脱敏类型
  custEvent:{type: Function},//自定义脱敏方法
})



</script>

<style lang="scss" scoped>
.underline {
  border-bottom: 1px solid #CDD0D6;
  width: 100%;
  display: block;
}
</style>
