Skip to content

Commit

Permalink
perf: 列排序
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Aug 28, 2021
1 parent 2db661c commit 7c0b019
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 0 additions & 5 deletions packages/fast-crud/src/components/crud/fs-table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,10 @@ export default {
return cellRef?.getTargetRef();
};

const { doComputed } = useCompute();
const refColumns = toRef(props, "columns");
const computedColumns = doComputed(refColumns, null, [/\[.+\]component/]);

return {
tableRef,
componentRefs,
getComponentRef,
computedColumns,
...useEditable(props, ctx, tableRef)
};
},
Expand Down
7 changes: 5 additions & 2 deletions packages/fast-crud/src/components/fs-crud.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
ref="tableRef"
class="fs-crud-table"
v-bind="computedTable"
:columns="computedTable.columns"
:row-handle="rowHandle"
:data="data"
:cell-slots="computedCellSlots"
Expand Down Expand Up @@ -336,7 +335,11 @@ export default defineComponent({
/**
* crud包裹容器的class
*/
customClass: {}
customClass: {},
/**
* 不要传到fs-table去
*/
form: {}
},
emits: [
"search-submit",
Expand Down
4 changes: 4 additions & 0 deletions packages/fast-crud/src/use/use-compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ function doComputed(target, getContextFn, excludes, userComputedFn) {

return computed(() => {
let targetValue = target.value;
if (targetValue instanceof Array) {
debugger;
}

if (asyncCount > 0 || syncCount > 0) {
targetValue = cloneDeep(targetValue);
if (syncCount > 0) {
Expand Down
6 changes: 5 additions & 1 deletion packages/fast-crud/src/use/use-crud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,11 @@ export function useCrud(ctx: UseCrudProps) {
userOptions.search = merge({ columns: baseColumnsForSearch }, { columns: searchColumns }, userOptions.search);

// tableColumns
userOptions.table.columns = tableColumns;
const sortedTableColumns = _.sortBy(tableColumns, (item) => {
return item.order ?? 1;
}); //排序
userOptions.table.columns = sortedTableColumns;

const tableColumnsMap = {};
_.forEach(tableColumns, (item) => {
tableColumnsMap[item.key] = item;
Expand Down

0 comments on commit 7c0b019

Please sign in to comment.