From d47ba09298fb7d3c50b3d85ad5870aec15668869 Mon Sep 17 00:00:00 2001 From: betavs Date: Wed, 10 Jun 2026 20:30:00 +0800 Subject: [PATCH 1/3] fix(table): handle custom class names for table columns --- packages/uniapp-components/table/table.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/uniapp-components/table/table.vue b/packages/uniapp-components/table/table.vue index 6cdfd3669..029468252 100644 --- a/packages/uniapp-components/table/table.vue +++ b/packages/uniapp-components/table/table.vue @@ -295,15 +295,30 @@ export default { return styles.join('; '); }, + getCustomClassName(className) { + const calcClassName = (name) => { + if (typeof name === 'function') { + return name() || ''; + } + return name; + }; + + if (Array.isArray(className)) { + return className.map(calcClassName); + } + return [calcClassName(className)]; + }, + getThClassName(col, colIndex) { const classes = []; if (col.colKey) classes.push(`${name}__th-${col.colKey}`); if (col.align && col.align !== 'left') classes.push(`${prefix}-align-${col.align}`); if (col.fixed === 'left') classes.push(`${name}__cell--fixed-left`); if (col.fixed === 'right') classes.push(`${name}__cell--fixed-right`); + if (col.className) classes.push(...this.getCustomClassName(col.className)); if (colIndex === this.lastFixedLeftIndex) classes.push(`${name}__cell--fixed-left-last`); if (colIndex === this.firstFixedRightIndex) classes.push(`${name}__cell--fixed-right-first`); - return classes.join(' '); + return classes; }, updateRenderData() { From 49bf26795d38891fad77782e4318ba249d5ce496 Mon Sep 17 00:00:00 2001 From: novlan1 <1576271227@qq.com> Date: Fri, 12 Jun 2026 16:56:23 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(table):=20=E9=98=B2=E6=AD=A2=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=BC=96=E8=AF=91=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uniapp-components/table/table.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uniapp-components/table/table.vue b/packages/uniapp-components/table/table.vue index 029468252..9c9576d87 100644 --- a/packages/uniapp-components/table/table.vue +++ b/packages/uniapp-components/table/table.vue @@ -295,7 +295,7 @@ export default { return styles.join('; '); }, - getCustomClassName(className) { + getCustomClassName(className = '') { const calcClassName = (name) => { if (typeof name === 'function') { return name() || ''; @@ -318,7 +318,7 @@ export default { if (col.className) classes.push(...this.getCustomClassName(col.className)); if (colIndex === this.lastFixedLeftIndex) classes.push(`${name}__cell--fixed-left-last`); if (colIndex === this.firstFixedRightIndex) classes.push(`${name}__cell--fixed-right-first`); - return classes; + return classes.join(' '); }, updateRenderData() { From 702ff57e51a1ff7765baa9ac60c11d98097ec37c Mon Sep 17 00:00:00 2001 From: tdesign-bot Date: Fri, 12 Jun 2026 08:57:10 +0000 Subject: [PATCH 3/3] chore: stash changelog [ci skip] --- packages/tdesign-uniapp/.changelog/pr-4500.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 packages/tdesign-uniapp/.changelog/pr-4500.md diff --git a/packages/tdesign-uniapp/.changelog/pr-4500.md b/packages/tdesign-uniapp/.changelog/pr-4500.md new file mode 100644 index 000000000..f0f4b2369 --- /dev/null +++ b/packages/tdesign-uniapp/.changelog/pr-4500.md @@ -0,0 +1,6 @@ +--- +pr_number: 4500 +contributor: betavs +--- + +- fix(Table): 修复列配置中的类名选项无效的问题 @betavs ([#4500](https://github.com/Tencent/tdesign-miniprogram/pull/4500))