update 首页自定义布局
This commit is contained in:
@@ -200,13 +200,13 @@
|
||||
<el-col :span="8"><span></span></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="selectLayout-item item03" :class="{ active: grid.layout.join(',') === '24' }" @click="setLayout([24])">
|
||||
<!-- <div class="selectLayout-item item03" :class="{ active: grid.layout.join(',') === '24' }" @click="setLayout([24])">
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="24"><span></span></el-col>
|
||||
<el-col :span="24"><span></span></el-col>
|
||||
<el-col :span="24"><span></span></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
@@ -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<number>) => {
|
||||
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) => {
|
||||
|
||||
Reference in New Issue
Block a user