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-03-27 17:19:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
923f6e20136599f56fcc5e3072cf1a58f618deae
923f6e20
1 parent
8f98129c
fix(MultiRuleField): 修复验证器中未处理空值的潜在错误
在处理`props.item.value`时,添加可选链操作符以避免空值导致的错误
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
src/components/MultiRuleField/index.vue
src/components/MultiRuleField/index.vue
View file @
923f6e2
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 202
4-08-03 20:35:26
* @LastEditTime: 202
5-03-27 17:18:55
* @FilePath: /data-table/src/components/MultiRuleField/index.vue
* @Description: 多选规则确认控件
-->
...
...
@@ -106,9 +106,9 @@ const max_count = props.item.component_props.max_count;
const validator = (val) => {
if (required && !val.length) {
return false;
} else if (min_count && props.item.value.length < min_count) {
} else if (min_count && props.item.value
?
.length < min_count) {
return false;
} else if (max_count && props.item.value.length > max_count) {
} else if (max_count && props.item.value
?
.length > max_count) {
return false;
} else {
return true;
...
...
@@ -118,9 +118,9 @@ const validator = (val) => {
const validatorMessage = (val, rule) => {
if (required && !val.length) {
return "选择项不能为空";
} else if (min_count && props.item.value.length < min_count) {
} else if (min_count && props.item.value
?
.length < min_count) {
return `最少选择${min_count}项`;
} else if (max_count && props.item.value.length > max_count) {
} else if (max_count && props.item.value
?
.length > max_count) {
return `最多选择${max_count}项`;
}
};
...
...
Please
register
or
login
to post a comment