hookehuyr

✨ feat: 添加错误滚动功能

<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-04-04 11:03:21
* @LastEditTime: 2023-04-04 15:11:55
* @FilePath: /custom_form/src/components/CheckboxField/index.vue
* @Description: 多项选择控件
-->
......@@ -142,7 +142,7 @@ const validCheckbox = () => {
return !show_error.value;
};
defineExpose({ validCheckbox });
defineExpose({ validCheckbox, id: props.item.key });
</script>
<style lang="less">
......
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-04-04 15:00:16
* @LastEditTime: 2023-04-04 15:07:00
* @FilePath: /custom_form/src/components/MultiRuleField/index.vue
* @Description: 多选规则确认控件
-->
......@@ -136,7 +136,7 @@ const validMultiRule= () => {
return !show_error.value;
};
defineExpose({ validMultiRule });
defineExpose({ validMultiRule, id: props.item.key });
</script>
<style lang="less">
......
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-04-04 14:58:27
* @LastEditTime: 2023-04-04 15:11:44
* @FilePath: /custom_form/src/components/RadioField/index.vue
* @Description: 单项选择控件
-->
......@@ -156,7 +156,7 @@ const validRadio = () => {
return !show_error.value;
};
defineExpose({ validRadio });
defineExpose({ validRadio, id: props.item.key });
</script>
<style lang="less">
......
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-04-03 13:31:03
* @LastEditTime: 2023-04-04 15:11:19
* @FilePath: /custom_form/src/components/TextField/index.vue
* @Description: 单行文本输入框(微信扫描功能)
-->
......@@ -168,7 +168,7 @@ const validInput = () => {
return !show_error.value;
};
defineExpose({ validInput });
defineExpose({ validInput, id: props.item.key });
</script>
<style lang="less">
......
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-04-03 14:07:03
* @LastEditTime: 2023-04-04 15:11:32
* @FilePath: /custom_form/src/components/TextareaField/index.vue
* @Description: 多行文本输入框
-->
......@@ -86,7 +86,7 @@ const validTextarea = () => {
return !show_error.value;
};
defineExpose({ validTextarea });
defineExpose({ validTextarea, id: props.item.key });
</script>
<style lang="less">
......
<!--
* @Date: 2023-03-24 09:19:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-04-04 14:38:13
* @LastEditTime: 2023-04-04 15:38:07
* @FilePath: /custom_form/src/pages/table/index.vue
* @Description: 文件描述
-->
......@@ -428,6 +428,7 @@ const validOther = () => {
let valid = {
status: true,
key: "",
id: ''
};
if (input.value) {
// 单行文本
......@@ -436,6 +437,7 @@ const validOther = () => {
valid = {
status: input.value[index].validInput(),
key: "input",
id: multi_rule.value[index].id
};
return false;
}
......@@ -448,6 +450,7 @@ const validOther = () => {
valid = {
status: textarea.value[index].validTextarea(),
key: "textarea",
id: multi_rule.value[index].id
};
return false;
}
......@@ -460,6 +463,7 @@ const validOther = () => {
valid = {
status: radio.value[index].validRadio(),
key: "radio",
id: multi_rule.value[index].id
};
return false;
}
......@@ -472,6 +476,7 @@ const validOther = () => {
valid = {
status: checkbox.value[index].validCheckbox(),
key: "checkbox",
id: multi_rule.value[index].id
};
return false;
}
......@@ -484,6 +489,7 @@ const validOther = () => {
valid = {
status: multi_rule.value[index].validMultiRule(),
key: "multi_rule",
id: multi_rule.value[index].id
};
return false;
}
......@@ -592,7 +598,13 @@ const onSubmit = async (values) => {
}
}
} else {
console.warn(validOther().key + "不通过验证");
console.warn(validOther().id + ' ' + validOther().key + "不通过验证");
if (validOther().id) {
Taro.pageScrollTo({
selector: `#${validOther().id}`,
duration: 300
})
}
// // 图片上传控件报错提示
// if (validOther().key === "image_uploader") {
// showFailToast("图片上传为空");
......@@ -610,6 +622,7 @@ const onSubmit = async (values) => {
background-color: #FAF9DC;
min-height: calc(100vh);
position: relative;
overflow: auto;
}
.table-title {
padding: 30px;
......