Skip to content

Commit

Permalink
fix: 修复group配置没有的字段报空指针异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Aug 25, 2022
1 parent 96dcc2d commit 438d0ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/fast-crud/src/components/crud/fs-form-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<component
:is="$fsui.formItem.name"
class="fs-form-item"
:[$fsui.formItem.prop]="item.key"
:[$fsui.formItem.prop]="item?.key"
v-bind="item"
:path="item.key"
:path="item?.key"
>
<template #label>
{{ item.label || item.title }}
Expand Down
8 changes: 6 additions & 2 deletions packages/fast-crud/src/components/crud/fs-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- row -->
<component :is="$fsui.row.name" class="fs-row">
<!-- col -->
<template v-for="item in computedDefaultColumns" :key="item.key">
<template v-for="item in computedDefaultColumns" :key="item?.key">
<component :is="$fsui.col.name" v-if="item.show !== false" class="fs-col" v-bind="mergeCol(item.col)">
<fs-form-item
v-if="item.blank !== true"
Expand Down Expand Up @@ -62,7 +62,7 @@
v-bind="mergeCol(computedColumns[key]?.col)"
>
<fs-form-item
v-if="computedColumns[key]?.blank !== true"
v-if="computedColumns[key] && computedColumns[key]?.blank !== true"
:ref="
(el) => {
if (el) {
Expand Down Expand Up @@ -92,6 +92,7 @@ import logger from "../../utils/util.log";
import { uiContext } from "../../ui";
import { useMerge } from "../../use/use-merge";
import { Constants } from "../../utils/util.constants";
import { utils } from "../../index";
/**
* 配置化的表单组件
Expand Down Expand Up @@ -324,6 +325,9 @@ export default {
const groupedKeys = new Set();
_.forEach(group?.groups, (groupItem) => {
_.forEach(groupItem.columns, (item) => {
if (computedColumns.value[item] == null) {
utils.logger.warn("无效的分组字段:" + item);
}
groupedKeys.add(item);
});
});
Expand Down

0 comments on commit 438d0ad

Please sign in to comment.