直播带货源码,vue 身份证校验js及其***显示
校验js
const idCardRule = (rule, value, callback) => {
let reg = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/i
if (value && !reg.test(value)) {
callback(new Error('身份证号格式有误'))
} else {
callback()
}
//添加规则
idCard:[{validator: idCardRule, trigger: 'blur'}]
显示,正则表达式替换
<u-table-column prop="idCard" label="身份证号码" align="center" min-width="160px">
<template slot-scope="scope">
<span>{{scope.row.idCard ? scope.row.idCard.replace(/^(.{6})(?:\w+)(.{4})$/, '\$1********\$2') : '--'}}</span>
</template>
</u-table-column>
以上就是直播带货源码,vue 身份证校验js及其***显示, 更多内容欢迎关注之后的文章
标签:vue,idCard,校验,value,js,直播 From: https://www.cnblogs.com/yunbaomengnan/p/17679435.html