diff --git a/src/views/home/widgets/index.vue b/src/views/home/widgets/index.vue
index cde3eaa..5f040ba 100644
--- a/src/views/home/widgets/index.vue
+++ b/src/views/home/widgets/index.vue
@@ -200,13 +200,13 @@
-
+
@@ -262,11 +262,13 @@ const defaultGrid = ref({
['TaskList'], // 第四列,占8
],
});
-const isDefaultLayout = ref(true);
const customizing = ref(false);
const widgets = ref();
const widgetsKey = ref('widgets');
const grid = ref(cloneDeep(toValue(defaultGrid)));
+// 默认布局是4组
+// const isDefaultLayout = ref(true);
+const isDefaultLayout = ref(grid.value.copmsList.length === 4);
const allComponentList = computed(() => {
const list = [];
@@ -330,16 +332,21 @@ const custom = () => {
const setLayout = (layout: Array) => {
grid.value.layout = layout;
- isDefaultLayout.value = false;
- if (layout.join(',') === '24') {
- if (grid.value.copmsList[1]) {
- grid.value.copmsList[0].push(...grid.value.copmsList[1]);
- }
- if (grid.value.copmsList[2]) {
- grid.value.copmsList[0].push(...grid.value.copmsList[2]);
- }
- grid.value.copmsList.splice(1, 2);
+ // 默认布局是4组,非默认布局是3组,所以要合并,不然会丢组件
+ if (isDefaultLayout.value && grid.value.copmsList.length === 4) {
+ grid.value.copmsList[1] = [...grid.value.copmsList[1], ...grid.value.copmsList[3]];
+ grid.value.copmsList.splice(3, 1);
}
+ isDefaultLayout.value = false;
+ // if (layout.join(',') === '24') {
+ // if (grid.value.copmsList[1]) {
+ // grid.value.copmsList[0].push(...grid.value.copmsList[1]);
+ // }
+ // if (grid.value.copmsList[2]) {
+ // grid.value.copmsList[0].push(...grid.value.copmsList[2]);
+ // }
+ // grid.value.copmsList.splice(1, 2);
+ // }
};
const push = (item: any) => {