为了保护用户隐私,产品需求将table展示中的用户手机号中间四位以****显示。
如18212345678
显示为182 ****5678
<el-table-column prop="userPhone" label="用户手机号" min-width="160" sortable >
<template slot-scope="scope">
{{scope.row.userPhone?scope.row.userPhone.replace(/(\d{3})(\d{4})(\d{4})/,"$1****$3"):""}}
</template>
</el-table-column>