Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
啊嘞嘞EC
vue-vben-admin
提交
1db72c8f
V
vue-vben-admin
项目概览
啊嘞嘞EC
/
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,发现更多精彩内容 >>
提交
1db72c8f
编写于
11月 05, 2020
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix form validate error
上级
db0bfc88
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
60 addition
and
31 deletion
+60
-31
CHANGELOG.en_US.md
CHANGELOG.en_US.md
+25
-0
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+2
-1
src/components/Form/src/BasicForm.vue
src/components/Form/src/BasicForm.vue
+11
-14
src/components/Form/src/FormItem.tsx
src/components/Form/src/FormItem.tsx
+12
-7
src/components/Form/src/hooks/useFormAction.ts
src/components/Form/src/hooks/useFormAction.ts
+10
-9
未找到文件。
CHANGELOG.en_US.md
浏览文件 @
1db72c8f
## Wip
### ⚡ Performance Improvements
-
Menu performance continues to be optimized and smoother
-
Optimize lazy loading components and examples
### 🎫 Chores
-
Delete menu background image
-
Update the version of ʻant-design-vue
`to`
beta13
`
- Update `
vite
` version to `
rc.9
`
- Exception page adjustment
- `
BasicTitle
` Color blocks are not displayed by default
### 🐛 Bug Fixes
- Fix table type problem after upgrade
- Fix the problem that the last submenu continues to be displayed when the menu is divided and there is no data in the left menu
- Fix the issue of ʻuseMessage`
type
-
Fix the problem that the form item setting
`disabled`
does not take effect
-
Fix that ʻuseECharts
`can't adapt when`
resize
`, and an error is reported
- Fix that `
resize
` is not deleted after ʻuseWatermark`
is cleared
-
Fix form verification problem
## 2.0.0-rc.8 (2020-11-2)
### ✨ Features
...
...
CHANGELOG.zh_CN.md
浏览文件 @
1db72c8f
...
...
@@ -11,7 +11,7 @@
-
更新
`ant-design-vue`
版本为
`beta13`
-
更新
`vite`
版本为
`rc.9`
-
异常页调整
-
`BasicTitle`
Color blocks are not displayed by default
-
`BasicTitle`
色块默认不显示
### 🐛 Bug Fixes
...
...
@@ -21,6 +21,7 @@
-
修复表单项设置
`disabled`
不生效问题
-
修复
`useECharts`
在
`resize`
时不能自适应,报错
-
修复
`useWatermark`
在清空后
`resize`
未删除
-
修复表单校验问题
## 2.0.0-rc.8 (2020-11-2)
...
...
src/components/Form/src/BasicForm.vue
浏览文件 @
1db72c8f
...
...
@@ -28,16 +28,7 @@
import
type
{
Ref
}
from
'
vue
'
;
import
type
{
ValidateFields
}
from
'
ant-design-vue/lib/form/interface
'
;
import
{
defineComponent
,
reactive
,
ref
,
computed
,
unref
,
toRef
,
onMounted
,
watchEffect
,
}
from
'
vue
'
;
import
{
defineComponent
,
reactive
,
ref
,
computed
,
unref
,
toRef
,
onMounted
,
watch
}
from
'
vue
'
;
import
{
Form
,
Row
}
from
'
ant-design-vue
'
;
import
FormItem
from
'
./FormItem
'
;
import
{
basicProps
}
from
'
./props
'
;
...
...
@@ -153,10 +144,16 @@
actionState
,
});
watchEffect
(()
=>
{
if
(
!
unref
(
getMergePropsRef
).
model
)
return
;
setFieldsValue
(
unref
(
getMergePropsRef
).
model
);
});
watch
(
()
=>
unref
(
getMergePropsRef
).
model
,
()
=>
{
if
(
!
unref
(
getMergePropsRef
).
model
)
return
;
setFieldsValue
(
unref
(
getMergePropsRef
).
model
);
},
{
immediate
:
true
,
}
);
/**
* @description:设置表单
...
...
src/components/Form/src/FormItem.tsx
浏览文件 @
1db72c8f
...
...
@@ -14,6 +14,8 @@ import { createPlaceholderMessage } from './helper';
import
{
upperFirst
,
cloneDeep
}
from
'
lodash-es
'
;
import
{
useItemLabelWidth
}
from
'
./hooks/useLabelWidth
'
;
import
{
ComponentType
}
from
'
./types
'
;
import
{
isNumber
}
from
'
../../../utils/is
'
;
export
default
defineComponent
({
name
:
'
BasicFormItem
'
,
...
...
@@ -145,6 +147,14 @@ export default defineComponent({
return
rules
;
}
function
handleValue
(
component
:
ComponentType
,
field
:
string
)
{
const
val
=
(
props
.
formModel
as
any
)[
field
];
if
([
'
Input
'
,
'
InputPassword
'
,
'
InputSearch
'
,
'
InputTextArea
'
].
includes
(
component
))
{
return
isNumber
(
val
)
&&
val
?
`
${
val
}
`
:
val
;
}
return
val
;
}
function
renderComponent
()
{
const
{
componentProps
,
...
...
@@ -162,11 +172,7 @@ export default defineComponent({
if
(
propsData
[
eventKey
])
{
propsData
[
eventKey
](
e
);
}
if
(
e
&&
e
.
target
)
{
(
props
.
formModel
as
any
)[
field
]
=
e
.
target
.
value
;
}
else
{
(
props
.
formModel
as
any
)[
field
]
=
e
;
}
(
props
.
formModel
as
any
)[
field
]
=
e
&&
e
.
target
?
e
.
target
.
value
:
e
;
},
};
const
Comp
=
componentMap
.
get
(
component
);
...
...
@@ -190,9 +196,8 @@ export default defineComponent({
propsData
.
placeholder
=
placeholder
;
propsData
.
codeField
=
field
;
propsData
.
formValues
=
unref
(
getValuesRef
);
const
bindValue
=
{
[
isCheck
?
'
checked
'
:
'
value
'
]:
(
props
.
formModel
as
any
)[
field
]
,
[
isCheck
?
'
checked
'
:
'
value
'
]:
handleValue
(
component
,
field
)
,
};
if
(
!
renderComponentContent
)
{
return
<
Comp
{
...
propsData
}
{
...
on
}
{
...
bindValue
}
/>;
...
...
src/components/Form/src/hooks/useFormAction.ts
浏览文件 @
1db72c8f
...
...
@@ -43,8 +43,6 @@ export function useFormAction({
Object
.
keys
(
formModel
).
forEach
((
key
)
=>
{
(
formModel
as
any
)[
key
]
=
defaultValueRef
.
value
[
key
];
});
// @ts-ignore
// TODO 官方组件库类型定义错误,可以不传参数
formEl
.
clearValidate
();
emit
(
'
reset
'
,
toRaw
(
formModel
));
// return values;
...
...
@@ -58,10 +56,12 @@ export function useFormAction({
const
fields
=
unref
(
getSchema
)
.
map
((
item
)
=>
item
.
field
)
.
filter
(
Boolean
);
const
formEl
=
unref
(
formElRef
);
// const formEl = unref(formElRef);
const
validKeys
:
string
[]
=
[];
Object
.
keys
(
values
).
forEach
((
key
)
=>
{
const
element
=
values
[
key
];
if
(
fields
.
includes
(
key
)
&&
element
!==
undefined
&&
element
!==
null
)
{
if
(
element
!==
undefined
&&
element
!==
null
&&
fields
.
includes
(
key
)
)
{
// 时间
if
(
itemIsDateType
(
key
))
{
if
(
Array
.
isArray
(
element
))
{
...
...
@@ -76,11 +76,12 @@ export function useFormAction({
}
else
{
(
formModel
as
any
)[
key
]
=
element
;
}
if
(
formEl
)
{
formEl
.
validateFields
([
key
]);
}
validKeys
.
push
(
key
);
}
});
// if (formEl) {
// formEl.validateFields(validKeys);
// }
}
/**
* @description: 根据字段名删除
...
...
@@ -151,8 +152,8 @@ export function useFormAction({
updateData
.
forEach
((
item
)
=>
{
unref
(
getSchema
).
forEach
((
val
)
=>
{
if
(
val
.
field
===
item
.
field
)
{
const
newSche
am
=
deepMerge
(
val
,
item
);
schema
.
push
(
newSche
am
as
FormSchema
);
const
newSche
ma
=
deepMerge
(
val
,
item
);
schema
.
push
(
newSche
ma
as
FormSchema
);
}
else
{
schema
.
push
(
val
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录