fix(仓库交错视图): 调整单元格宽度计算逻辑
优化单元格宽度计算,当列数超过10列时固定宽度为160px,并移除最小宽度限制以避免溢出
This commit is contained in:
@@ -190,11 +190,13 @@ export default {
|
|||||||
},
|
},
|
||||||
cellWidth() {
|
cellWidth() {
|
||||||
// 2. 优化cellWidth计算:最小宽度从120调整为80,避免列数过多时宽度过大导致溢出
|
// 2. 优化cellWidth计算:最小宽度从120调整为80,避免列数过多时宽度过大导致溢出
|
||||||
if (!this.containerWidth || this.sortedColumnKeys.length === 0) return 120;
|
if (!this.containerWidth || this.sortedColumnKeys.length === 0) return 160;
|
||||||
|
// 如果列数超过10列,则宽度固定为160px
|
||||||
|
if (this.sortedColumnKeys.length > 10) return 160;
|
||||||
const availableWidth = Math.max(0, this.containerWidth - 30); // 30是行标尺宽度
|
const availableWidth = Math.max(0, this.containerWidth - 30); // 30是行标尺宽度
|
||||||
const calcWidth = availableWidth / this.sortedColumnKeys.length;
|
const calcWidth = availableWidth / this.sortedColumnKeys.length;
|
||||||
// 最小宽度80px,最大不限制(交给滚动容器处理)
|
// 最小宽度80px,最大不限制(交给滚动容器处理)
|
||||||
return Math.max(120, calcWidth);
|
return calcWidth;
|
||||||
},
|
},
|
||||||
halfCellWidth() {
|
halfCellWidth() {
|
||||||
return this.cellWidth / 2;
|
return this.cellWidth / 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user