feat: calc top for table affix

This commit is contained in:
Uyarn 2022-04-28 14:53:35 +08:00 committed by PY
parent 595c282bd2
commit 3cd18f18f7
3 changed files with 38 additions and 1 deletions

View File

@ -161,6 +161,23 @@ const navToHelper = () => {
height: 64px;
}
&-menu-fixed {
position: fixed;
top: 0;
z-index: 1001;
&-side {
left: 232px;
right: 0;
z-index: 10;
width: auto;
transition: all 0.3s;
&-compact {
left: 64px;
}
}
}
&-logo-container {
cursor: pointer;
display: inline-flex;

View File

@ -26,7 +26,7 @@
:selected-row-keys="selectedRowKeys"
:loading="dataLoading"
:header-affixed-top="true"
:header-affix-props="{ offsetTop: 0, container: getContainer }"
:header-affix-props="{ offsetTop, container: getContainer }"
@page-change="rehandlePageChange"
@change="rehandleChange"
@select-change="rehandleSelectChange"
@ -85,9 +85,12 @@ import { CONTRACT_STATUS, CONTRACT_TYPES, CONTRACT_PAYMENT_TYPES } from '@/const
import Trend from '@/components/trend/index.vue';
import { ResDataType } from '@/interface';
import request from '@/utils/request';
import { useSettingStore } from '@/store';
import { COLUMNS } from './constants';
const store = useSettingStore();
const data = ref([]);
const pagination = ref({
defaultPageSize: 20,
@ -179,6 +182,10 @@ const handleClickDelete = (row: { rowIndex: any }) => {
confirmVisible.value = true;
};
const offsetTop = computed(() => {
return store.isUseTabsRouter ? 48 : 0;
});
const getContainer = () => {
return document.querySelector('.tdesign-starter-layout');
};

View File

@ -64,6 +64,8 @@
:hover="hover"
:pagination="pagination"
:loading="dataLoading"
:header-affixed-top="true"
:header-affix-props="{ offsetTop, container: getContainer }"
@page-change="rehandlePageChange"
@change="rehandleChange"
>
@ -108,6 +110,7 @@ import { MessagePlugin } from 'tdesign-vue-next';
import Trend from '@/components/trend/index.vue';
import request from '@/utils/request';
import { ResDataType } from '@/interface';
import { useSettingStore } from '@/store';
import {
CONTRACT_STATUS,
@ -117,6 +120,8 @@ import {
CONTRACT_PAYMENT_TYPES,
} from '@/constants';
const store = useSettingStore();
const COLUMNS = [
{
title: '合同名称',
@ -250,6 +255,14 @@ const rehandleChange = (changeParams, triggerAndData) => {
const rehandleClickOp = ({ text, row }) => {
console.log(text, row);
};
const offsetTop = computed(() => {
return store.isUseTabsRouter ? 48 : 0;
});
const getContainer = () => {
return document.querySelector('.tdesign-starter-layout');
};
</script>
<style lang="less">