Skip to content

Commit

Permalink
perf: lodash按需引入
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Nov 9, 2020
1 parent 40cd7d1 commit 94f00e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/crud-table/src/CrudTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ import { confirm } from '@/utils/confirm';
import SvgIcon from '@/icons/SvgIcon.vue';
import GenerateFormDialog from './GenerateFormDialog.vue';
import SearchForm from './SearchForm.vue';
import _cloneDeep from 'lodash/cloneDeep'

const STATUS = {
CREATE: 0,
Expand Down Expand Up @@ -624,7 +625,7 @@ export default class CrudTable extends Vue {
// 操作列-添加
actionColumnAdd(row) {
// 添加成功后需要刷新当前结点的子节点,此处特殊处理
this.currentRow.parentid = this.lodash.cloneDeep(row).id;
this.currentRow.parentid = _cloneDeep(row).id;
if (this.btnRowAddOnClick) {
this.btnRowAddOnClick(row);
} else if (this.prefill) {
Expand Down
1 change: 0 additions & 1 deletion packages/shims-vue-expand.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
declare module 'vue/types/vue' {
interface Vue {
$store: any;
lodash: any;
axios: any;
dayjs: any;
$pinyinmatch: any;
Expand Down
8 changes: 5 additions & 3 deletions packages/table-designer/src/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
<script>
import { DML, crud } from '@/api/public/crud';
import { getFormDetail } from '@/api/system/form';
import _forEach from 'lodash/forEach';
import _pick from 'lodash/pick'

export default {
name: 'MenuBar',
Expand Down Expand Up @@ -95,9 +97,9 @@ export default {
const jsonObj = JSON.parse(res.data.formJson);
const done = [];
// 遍历行
this.lodash.forEach(jsonObj.list, (row) => {
_forEach(jsonObj.list, (row) => {
// 遍历列
this.lodash.forEach(row.columns, (column) => {
_forEach(row.columns, (column) => {
const first = column.list[0];
if (first && 'date,select'.includes(first.type)) {
// 从表单复制到表格的属性
Expand All @@ -113,7 +115,7 @@ export default {
'props',
'options',
];
const option = this.lodash.pick(first.options, keyList);
const option = _pick(first.options, keyList);
option.type = first.type;
// 遍历当前表格配置,加入option
for (const col of this.designedJSON.columns) {
Expand Down

0 comments on commit 94f00e3

Please sign in to comment.