Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Lucky高
vue-vben-admin
提交
58b30aae
V
vue-vben-admin
项目概览
Lucky高
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
58b30aae
编写于
10月 29, 2022
作者:
无
无木
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: form advanced logic,fixed #2124, #2078,#2089 . follow #2125
上级
4f9cdc56
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
6 deletion
+13
-6
src/components/Form/src/BasicForm.vue
src/components/Form/src/BasicForm.vue
+3
-1
src/components/Form/src/components/FormItem.vue
src/components/Form/src/components/FormItem.vue
+5
-2
src/components/Form/src/hooks/useAdvanced.ts
src/components/Form/src/hooks/useAdvanced.ts
+5
-3
未找到文件。
src/components/Form/src/BasicForm.vue
浏览文件 @
58b30aae
...
...
@@ -10,6 +10,7 @@
<slot
name=
"formHeader"
></slot>
<template
v-for=
"schema in getSchema"
:key=
"schema.field"
>
<FormItem
:isAdvanced=
"fieldsIsAdvancedMap[schema.field]"
:tableAction=
"tableAction"
:formActionType=
"formActionType"
:schema=
"schema"
...
...
@@ -141,7 +142,7 @@
}
});
const
{
handleToggleAdvanced
}
=
useAdvanced
({
const
{
handleToggleAdvanced
,
fieldsIsAdvancedMap
}
=
useAdvanced
({
advanceState
,
emit
,
getProps
,
...
...
@@ -299,6 +300,7 @@
getFormActionBindProps
:
computed
(
():
Recordable
=>
({
...
getProps
.
value
,
...
advanceState
}),
),
fieldsIsAdvancedMap
,
...
formActionType
,
};
},
...
...
src/components/Form/src/components/FormItem.vue
浏览文件 @
58b30aae
...
...
@@ -44,6 +44,9 @@
formActionType
:
{
type
:
Object
as
PropType
<
FormActionType
>
,
},
isAdvanced
:
{
type
:
Boolean
,
},
},
setup
(
props
,
{
slots
})
{
const
{
t
}
=
useI18n
();
...
...
@@ -103,8 +106,8 @@
const
{
show
,
ifShow
}
=
props
.
schema
;
const
{
showAdvancedButton
}
=
props
.
formProps
;
const
itemIsAdvanced
=
showAdvancedButton
?
isBoolean
(
props
.
schema
.
isAdvanced
)
?
props
.
schema
.
isAdvanced
?
isBoolean
(
props
.
isAdvanced
)
?
props
.
isAdvanced
:
true
:
true
;
...
...
src/components/Form/src/hooks/useAdvanced.ts
浏览文件 @
58b30aae
import
type
{
ColEx
}
from
'
../types
'
;
import
type
{
AdvanceState
}
from
'
../types/hooks
'
;
import
{
ComputedRef
,
getCurrentInstance
,
Ref
}
from
'
vue
'
;
import
{
ComputedRef
,
getCurrentInstance
,
Ref
,
shallowReactive
}
from
'
vue
'
;
import
type
{
FormProps
,
FormSchema
}
from
'
../types/form
'
;
import
{
computed
,
unref
,
watch
}
from
'
vue
'
;
import
{
isBoolean
,
isFunction
,
isNumber
,
isObject
}
from
'
/@/utils/is
'
;
...
...
@@ -113,6 +113,8 @@ export default function ({
}
}
const
fieldsIsAdvancedMap
=
shallowReactive
({});
function
updateAdvanced
()
{
let
itemColSum
=
0
;
let
realItemColSum
=
0
;
...
...
@@ -148,7 +150,7 @@ export default function ({
if
(
isAdvanced
)
{
realItemColSum
=
itemColSum
;
}
schema
.
isAdvanced
=
isAdvanced
;
fieldsIsAdvancedMap
[
schema
.
field
]
=
isAdvanced
;
}
}
...
...
@@ -166,5 +168,5 @@ export default function ({
advanceState
.
isAdvanced
=
!
advanceState
.
isAdvanced
;
}
return
{
handleToggleAdvanced
};
return
{
handleToggleAdvanced
,
fieldsIsAdvancedMap
};
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录