Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2025-10-07 10:33:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a40bf7e5217b47eb57268e53382fb8e5014d0ff5
a40bf7e5
1 parent
c85903b0
fix(IdentityField): 确保身份证号验证前转换为字符串类型
避免当传入非字符串类型值时导致indexOf方法调用失败
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
src/components/IdentityField/index.vue
src/components/IdentityField/index.vue
View file @
a40bf7e
...
...
@@ -137,7 +137,9 @@ watch(
(v) => {
if (v) {
props.item.value = v;
if (v.indexOf('*') !== -1) { // 默认值是加密模式
// 确保v是字符串类型后再调用indexOf方法
const vStr = String(v);
if (vStr.indexOf('*') !== -1) { // 默认值是加密模式
props.item.component_props.readonly = true;
data_type.value = 'encrypt_mode';
}
...
...
@@ -191,13 +193,15 @@ var checkCode = function (val) {
const idCard = {
verify: function (val) {
if (val.indexOf('*') !== -1 && data_type.value === 'encrypt_mode') { // 默认值是加密模式,跳过校验
// 确保val是字符串类型
const valStr = String(val || '');
if (valStr.indexOf('*') !== -1 && data_type.value === 'encrypt_mode') { // 默认值是加密模式,跳过校验
return true;
}
if (checkCode(val)) {
var date = val.substring(6,14);
if (checkCode(val
Str
)) {
var date = val
Str
.substring(6,14);
if (checkDate(date)) {
if (checkProv(val.substring(0,2))) {
if (checkProv(val
Str
.substring(0,2))) {
return true;
}
}
...
...
Please
register
or
login
to post a comment