Skip to content

Commit

Permalink
fix(anyof): 新值为object类型直接覆盖
Browse files Browse the repository at this point in the history
fix #77
  • Loading branch information
lljj-x committed Sep 21, 2021
1 parent 85d9545 commit d2f9791
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ export default {
// 设置新值
if (isObject(newOptionData)) {
Object.entries(newOptionData).forEach(([key, value]) => {
if (value !== undefined && (curFormData[key] === undefined || this.selectList[newVal].properties[key].const !== undefined)) {
if (
value !== undefined
&& (
curFormData[key] === undefined
|| this.selectList[newVal].properties[key].const !== undefined
|| isObject(value)
)
) {
// 这里没找到一个比较合理的新旧值合并方式
//
// 1. 如果anyOf里面同名属性中的schema包含了 const 配置,产生了新的值这里做覆盖处理
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ export default {
// 设置新值
if (isObject(newOptionData)) {
Object.entries(newOptionData).forEach(([key, value]) => {
if (value !== undefined && (curFormData[key] === undefined || props.selectList[newVal].properties[key].const !== undefined)) {
if (
value !== undefined
&& (
curFormData[key] === undefined
|| props.selectList[newVal].properties[key].const !== undefined
|| isObject(value)
)
) {
// 这里没找到一个比较合理的新旧值合并方式
//
// 1. 如果anyOf里面同名属性中的schema包含了 const 配置,产生了新的值这里做覆盖处理
Expand Down

0 comments on commit d2f9791

Please sign in to comment.