首页 > 其他分享 >Vue设计table中的身份证号加密显示

Vue设计table中的身份证号加密显示

时间:2022-12-08 09:47:47浏览次数:37  
标签:Vue 加密 idcard 身份证号 scope table row

为了保护用户隐私,需要对身份证号中间进行加密,且需要考虑末尾带有X的情况

话不多少直接上代码,运用正则解决:

<el-table-column prop="idcard" label="身份证" width="180">
          <template slot-scope="scope">{{
            scope.row.idcard
              ? scope.row.idcard.replace(
                  /^(.{6})(?:\w+)(.{4})$/,
                  "\$1********\$2"
                )
              : ""
          }}</template>
</el-table-column>

标签:Vue,加密,idcard,身份证号,scope,table,row
From: https://www.cnblogs.com/wangzheming35/p/16965220.html

相关文章