Compare commits

...

2 Commits

@ -58,6 +58,7 @@ const actionsColumns = {
title: '操作',
key: 'actions',
minWidth: 200,
width: 200,
fixed: 'right',
render(row) {
return h(ListAction, {
@ -394,15 +395,6 @@ async function formatColumns() {
key: columnsRef.value[index].key,
fixed: columnsRef.value[index].fixed || undefined,
width: 200,
sorter: 'default',
renderSorterIcon: ({ order }) => {
if (order === false)
return h(SvgIcon, { name: 'sort-2' })
if (order === 'ascend')
return h(SvgIcon, { name: 'sort-1' })
if (order === 'descend')
return h(SvgIcon, { name: 'sort-3' })
},
render(row: any) {
return row.fromusername
},
@ -576,6 +568,23 @@ const maxHeight = computed(() => {
return tableData.value.length ? `${unref(deviceHeight)}px` : 'auto'
})
const scrollX = computed(() => {
const table = unref(tableRef)
if (!table)
return
const tableEl: any = table?.$el
const wrapper = tableEl.querySelector('.n-data-table-wrapper')
const arr = columnsRef.value.filter(item => !item.fixed)
let width = 0
console.log(arr)
arr.forEach((item) => {
width += Number(item.width) || 200
})
console.log(wrapper.offsetWidth + width)
console.log(arr)
return wrapper.offsetWidth + width
})
query(pagination.page, pagination.pageSize)
const customTabelRef = ref(null)
@ -967,11 +976,12 @@ defineExpose({
</div>
<div class="wrapper-content">
<NDataTable
id="table"
ref="tableRef"
v-model:checked-row-keys="checkedRowKeys"
remote
:columns="columnsRef"
:scroll-x="1250"
:scroll-x="scrollX"
:max-height="maxHeight"
:data="tableData"
:loading="loading"

Loading…
Cancel
Save