Commit 0ddd6216 by 杨子

优化高度

parent 81746952
......@@ -73,9 +73,16 @@ const isHovering = ref(false)
const rowStyle = computed(() => {
let height = rowHeight.value
const len = bars.value.filter(v=>v.ganttBarConfig.isCover).length
if(len > 0) {
height = (rowHeight.value * 0.8 * len) + (rowHeight.value * 0.1) * (len +1)
// 取出bars.value中ganttBarConfig.top属性的最大值
const maxTop = bars.value.filter(v=>v.ganttBarConfig.isCover).reduce((acc, bar) => {
return Math.max(acc, bar.ganttBarConfig.top)
}, 0)
console.log('maxTop', maxTop);
if(maxTop > 0) {
height = (rowHeight.value * 0.8 * maxTop) + (rowHeight.value * 0.1) * (maxTop +1)
}
return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment