Skip to content

Commit

Permalink
fix(header): 🐛 表头内容更改时两边高度不统一
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyjone committed Jun 5, 2023
1 parent c243597 commit e3c7341
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/container/GanttHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import useGanttWidth from '@/composables/useGanttWidth';
import useStyle from '@/composables/useStyle';
import useParam from '@/composables/useParam';
import useElement from '@/composables/useElement';
import { onMounted } from 'vue';
import { onMounted, onUpdated } from 'vue';
import useGanttHeader from '@/composables/useGanttHeader';
const { $param } = useParam();
Expand All @@ -67,6 +67,7 @@ const { getGanttUnitColumnWidth } = useGanttWidth();
const { ganttHeaderRef, updateHeaderHeight } = useElement();
const { ganttHeader } = useGanttHeader();
onMounted(updateHeaderHeight);
onUpdated(updateHeaderHeight);
</script>

<style lang="scss">
Expand Down
3 changes: 2 additions & 1 deletion src/components/container/TableHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import useSlotsBox from '@/composables/useSlotsBox';
import useParams from '@/composables/useParam';
import TableHeaderTh from './TableHeaderTh.vue';
import useElement from '@/composables/useElement';
import { onMounted } from 'vue';
import { onMounted, onUpdated } from 'vue';
import useStyle from '@/composables/useStyle';
const { $slotsBox } = useSlotsBox();
Expand All @@ -38,6 +38,7 @@ const { $styleBox } = useStyle();
const { $param } = useParams();
const { tableHeaderRef, updateHeaderHeight } = useElement();
onMounted(updateHeaderHeight);
onUpdated(updateHeaderHeight);
</script>

<style lang="scss">
Expand Down
5 changes: 4 additions & 1 deletion src/composables/useElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default () => {
function updateHeaderHeight() {
if (!$param.headerHeight) return;

$param.headerHeight = getMaxHeaderHeight();
const maxHeight = getMaxHeaderHeight();
if ($param.headerHeight !== maxHeight) {
$param.headerHeight = maxHeight;
}
}

return {
Expand Down

0 comments on commit e3c7341

Please sign in to comment.