14 lines
474 B
TypeScript
14 lines
474 B
TypeScript
import { h } from 'vue'
|
|
|
|
export function useRenderHeader(node: any) {
|
|
const { column } = node
|
|
let realWidth = 0;
|
|
let span = document.createElement('span');
|
|
span.innerText = column.label;
|
|
document.body.appendChild(span);
|
|
realWidth = span.getBoundingClientRect().width;
|
|
column.minWidth = realWidth+16; // 可能还有边距/边框等值,需要根据实际情况加上
|
|
document.body.removeChild(span);
|
|
|
|
return h('span', column.label)
|
|
} |