hookehuyr

✨ feat: 完善错误滚动功能

1 <!-- 1 <!--
2 * @Date: 2022-08-30 11:34:19 2 * @Date: 2022-08-30 11:34:19
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-04-04 15:11:55 4 + * @LastEditTime: 2023-04-04 15:50:47
5 * @FilePath: /custom_form/src/components/CheckboxField/index.vue 5 * @FilePath: /custom_form/src/components/CheckboxField/index.vue
6 * @Description: 多项选择控件 6 * @Description: 多项选择控件
7 --> 7 -->
...@@ -120,7 +120,7 @@ const validCheckbox = () => { ...@@ -120,7 +120,7 @@ const validCheckbox = () => {
120 // 必填项 120 // 必填项
121 props.item.component_props.options.some(item => { 121 props.item.component_props.options.some(item => {
122 // 必选项勾选校验 122 // 必选项勾选校验
123 - if (!checkbox_value.value.length && item.input_required) { 123 + if (props.item.component_props.required && !checkbox_value.value.length) {
124 show_error.value = true; 124 show_error.value = true;
125 error_msg.value = '必填项不能为空'; 125 error_msg.value = '必填项不能为空';
126 return true; 126 return true;
......
...@@ -136,8 +136,8 @@ const showUrl = (rule) => { // 跳转设置链接 ...@@ -136,8 +136,8 @@ const showUrl = (rule) => { // 跳转设置链接
136 // 小程序需要配置制定域名内网页,功能无法实现。 136 // 小程序需要配置制定域名内网页,功能无法实现。
137 } 137 }
138 const rule_content = ref(""); 138 const rule_content = ref("");
139 -
140 const show_error = ref(false); 139 const show_error = ref(false);
140 +
141 // 校验模块 141 // 校验模块
142 const validRadio = () => { 142 const validRadio = () => {
143 // 必填项 143 // 必填项
......
1 <!-- 1 <!--
2 * @Date: 2023-03-24 09:19:27 2 * @Date: 2023-03-24 09:19:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-04-04 15:38:07 4 + * @LastEditTime: 2023-04-04 15:54:24
5 * @FilePath: /custom_form/src/pages/table/index.vue 5 * @FilePath: /custom_form/src/pages/table/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -437,7 +437,7 @@ const validOther = () => { ...@@ -437,7 +437,7 @@ const validOther = () => {
437 valid = { 437 valid = {
438 status: input.value[index].validInput(), 438 status: input.value[index].validInput(),
439 key: "input", 439 key: "input",
440 - id: multi_rule.value[index].id 440 + id: input.value[index]?.id
441 }; 441 };
442 return false; 442 return false;
443 } 443 }
...@@ -450,7 +450,7 @@ const validOther = () => { ...@@ -450,7 +450,7 @@ const validOther = () => {
450 valid = { 450 valid = {
451 status: textarea.value[index].validTextarea(), 451 status: textarea.value[index].validTextarea(),
452 key: "textarea", 452 key: "textarea",
453 - id: multi_rule.value[index].id 453 + id: textarea.value[index]?.id
454 }; 454 };
455 return false; 455 return false;
456 } 456 }
...@@ -463,7 +463,7 @@ const validOther = () => { ...@@ -463,7 +463,7 @@ const validOther = () => {
463 valid = { 463 valid = {
464 status: radio.value[index].validRadio(), 464 status: radio.value[index].validRadio(),
465 key: "radio", 465 key: "radio",
466 - id: multi_rule.value[index].id 466 + id: radio.value[index]?.id
467 }; 467 };
468 return false; 468 return false;
469 } 469 }
...@@ -476,7 +476,7 @@ const validOther = () => { ...@@ -476,7 +476,7 @@ const validOther = () => {
476 valid = { 476 valid = {
477 status: checkbox.value[index].validCheckbox(), 477 status: checkbox.value[index].validCheckbox(),
478 key: "checkbox", 478 key: "checkbox",
479 - id: multi_rule.value[index].id 479 + id: checkbox.value[index]?.id
480 }; 480 };
481 return false; 481 return false;
482 } 482 }
...@@ -489,7 +489,7 @@ const validOther = () => { ...@@ -489,7 +489,7 @@ const validOther = () => {
489 valid = { 489 valid = {
490 status: multi_rule.value[index].validMultiRule(), 490 status: multi_rule.value[index].validMultiRule(),
491 key: "multi_rule", 491 key: "multi_rule",
492 - id: multi_rule.value[index].id 492 + id: multi_rule.value[index]?.id
493 }; 493 };
494 return false; 494 return false;
495 } 495 }
......