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
2024-11-21 10:23:01 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fc020da47270eae938edb1567da9f6afb362136c
fc020da4
1 parent
8a5a5514
测试首页cookie问题操作
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
src/views/index.vue
src/views/index.vue
View file @
fc020da
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-1
0-25 20:45:12
* @LastEditTime: 2024-1
1-21 10:20:47
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -503,6 +503,22 @@ onMounted(async () => {
createComponentType(formData.value);
// TAG:不同类型提交表单处理
if (page_type === 'add' && model === 'edit') { // 表单为新增状态, 检查是否有未完成的表单信息
const existingCookie = Cookies.get($route.query.code);
if (existingCookie) {
// 如果Cookie存在,更新它
let object = JSON.parse(existingCookie);
console.warn(object);
// 默认值
const objectMap = new Map(Object.entries(object)); // 将 object 转换为 Map,Object.entries() 方法用于返回一个给定对象自身可枚举属性的键值对数组,数组中的每个元素是一个包含键值对的数组,[ ["name", "Alice"], ["age", 30], ["city", "New York"] ]
formData.value.forEach((item) => {
if (objectMap.has(item.key)) {
console.warn(objectMap.get(item.key));
item.component_props.default = objectMap.get(item.key);
}
});
}
}
if (page_type === 'add' && !force_back) { // 表单为新增状态, 非后台打开状态
// 过期时间显示
notice_text.value = `表单报名将在 ${formSetting.value.sjsj_end_time} 后结束`;
...
...
@@ -973,7 +989,7 @@ const onSubmit = async (values) => { // 表单提交回调
console.warn(removeField);
console.warn(postData.value);
}
//
if (model === 'edit' || model === 'preview' || page_type === 'info') return false;
if (model === 'edit' || model === 'preview' || page_type === 'info') return false;
// 提交按钮禁用
submitStatus.value = true;
// TAG:不同类型提交表单处理
...
...
Please
register
or
login
to post a comment