vue+element 实现身份证号码中间几位用星号显示.
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element

·
一开始在网上搜索的正则表达式是:
<el-table-column prop="ucnum" label="证件编号" min-width="18%" align="center">
<template slot-scope="scope">{{scope.row.ucnum? scope.row.ucnum.replace(/^(\d{4})\d+(\d{4})$/,"$1****$2"):""}}</template>
</el-table-column>
但是很快发现身份证号码尾部为X的话就失效了
换成这个:
<el-table-column prop="ucnum" label="证件编号" min-width="18%" align="center">
<template slot-scope="scope">{{scope.row.ucnum? scope.row.ucnum.replace(/^(.{6})(?:\w+)(.{4})$/, "\$1********\$2"):""}}</template>
</el-table-column>
就可以了。




A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:7 天前 )
c345bb45
1 年前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 1 年前
更多推荐
所有评论(0)