File tree Expand file tree Collapse file tree
tdesign-uniapp/.changelog Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ pr_number : 4500
3+ contributor : betavs
4+ ---
5+
6+ - fix(Table): 修复列配置中的类名选项无效的问题 @betavs ([ #4500 ] ( https://github.com/Tencent/tdesign-miniprogram/pull/4500 ) )
Original file line number Diff line number Diff line change @@ -295,12 +295,27 @@ export default {
295295 return styles .join (' ; ' );
296296 },
297297
298+ getCustomClassName (className = ' ' ) {
299+ const calcClassName = (name ) => {
300+ if (typeof name === ' function' ) {
301+ return name () || ' ' ;
302+ }
303+ return name;
304+ };
305+
306+ if (Array .isArray (className)) {
307+ return className .map (calcClassName);
308+ }
309+ return [calcClassName (className)];
310+ },
311+
298312 getThClassName (col , colIndex ) {
299313 const classes = [];
300314 if (col .colKey ) classes .push (` ${ name} __th-${ col .colKey } ` );
301315 if (col .align && col .align !== ' left' ) classes .push (` ${ prefix} -align-${ col .align } ` );
302316 if (col .fixed === ' left' ) classes .push (` ${ name} __cell--fixed-left` );
303317 if (col .fixed === ' right' ) classes .push (` ${ name} __cell--fixed-right` );
318+ if (col .className ) classes .push (... this .getCustomClassName (col .className ));
304319 if (colIndex === this .lastFixedLeftIndex ) classes .push (` ${ name} __cell--fixed-left-last` );
305320 if (colIndex === this .firstFixedRightIndex ) classes .push (` ${ name} __cell--fixed-right-first` );
306321 return classes .join (' ' );
You can’t perform that action at this time.
0 commit comments