html:
<transition name="slide-width">
<a-col class="fixed-small" v-show="isShow" :style="{height: `${ztreeHeight}px`}">
<div style="height: 500px; ">
555
</div>
</a-col>
</transition>
<a-col class="auto-small-full" :class="{ 'auto-small': isShow }" ref="rightBox">
<a-table
:size="state.tableSize"
:loading="state.loading"
:columns="dynamicColumns"
:data-source="state.dataSource"
:scroll="{ x: 1800 }"
:pagination="{
current: state.current,
pageSize: state.pageSize,
total: state.total,
size: 'middle',
showTotal: total => `共 ${total} 条`,
}"
@change="handleTableChange"
>
<template #statusOther="{ text }">
<a-tag :color="statusMap[text].status">
{{ statusMap[text].text }}
</a-tag>
</template>
<template #action="{ text, record }">
<a :title="text" @click="detailFuns(record)">查看详情</a>
</template>
</a-table>
</a-col>
const rightBox = ref();
let ztreeHeight = ref<number>(0);
onMounted(() => {
watch(
() => state.dataSource,
() => {
nextTick(()=>{
$(document).ready(()=>{
ztreeHeight.value = rightBox.value.$el.scrollHeight;
})
})
},
);
});
主要是动态数据请求回来之后获取元素的高度, 谁有更好的想法代码贴给我奥!