Repository navigation
style: system role member list - #8297
Conversation
| class-name="border-l!" | ||
| min-width="180" | ||
| show-overflow-tooltip | ||
| /> |
There was a problem hiding this comment.
Review
1. border-l! — version-dependent, and likely a specificity hack
- The trailing
!(important modifier) is Tailwind CSS v4 syntax (and UnoCSS). In Tailwind v3 it's the prefix form!border-l. If this project is on v3, the class silently does nothing. Verify the Tailwind version before merging. - If
!is only needed to win against Element Plus styles, that's a smell: Element's border rules target.el-table--border .el-table__cell(specificity 0,2,0) which beats a plain utility class (0,1,0). Forcing important instead of fixing the selector will bite you later when the theme changes. border-lonly setsborder-left-width. It relies on Element/Tailwind preflight forborder-styleand a saneborder-color. Withborder-collapse: collapseon the table, the rendered width can be inconsistent (collapsed border resolution picks the widest border on the shared edge), so you may get a double or invisible line depending on the neighbouring cell. Use an explicit pair:border-l border-gray-200(or your design token) rather than a bareborder-l!.
2. Header cells won't get the border → visual misalignment
class-name on el-table-column applies only to body cells (<td>). The header cell needs the separate label-class-name prop, otherwise the vertical divider stops at the header row.
<el-table-column
...
class-name="border-l border-gray-200"
label-class-name="border-l border-gray-200"
/>3. Scoped styles / CSS isolation
class-name injects classes that must resolve globally, on cells rendered outside this component's scoped-CSS scope. If you use <style scoped>, CSS Modules, a Tailwind prefix, or a build that only scans template files, the class may never apply. Tailwind's content scanning usually covers .vue templates, but a prefix would require tw-border-l!.
4. Presentational logic in the template + hard-coded string
- A raw class string is untyped and unimprovable; if more columns need the separator, extract a constant (
const DIVIDER = 'border-l ...') or a helper that returns{ class: ... }. - It also breaks silently if this column's position changes: the divider is tied to a specific column, not to "the column after the admin-only columns". If that's the intent, drive it from column index/
:cell-styleor adividerflag in a column config array. - Note this column is conditionally rendered (
v-if), so for non-admins it may be the first visible column — a left border on the leftmost cell often looks like a stray 1px line. Considerborder-ron the preceding column instead, or a container-level style.
5. Prefer Element's own APIs for table borders
If the goal is a simple vertical separator:
- Use the
borderprop onel-tablefor full grids, or - Use the
:cell-style/:header-cell-stylefunction so the border is theme-driven (CSS variables likevar(--el-border-color)) and respects dark mode automatically. Hard-coded utility colors won't followel-table's dark-mode variables.
6. Minor nits
v-if="currentRole.type !== ROLE_TYPE.ADMIN"— fine, but ifcurrentRolecan be null/undefined during async load, this throws. PrefercurrentRole?.type !== ROLE_TYPE.ADMINor a computed.prop="workspace_name"mixessnake_casewith thecamelCaseused elsewhere (currentRole). Not a bug, just inconsistent with typical Vue/JS naming.min-width="180"works (Vue coerces), but:min-width="180"is explicit and avoids the string→number coercion path.
Suggested version
<el-table-column
v-if="currentRole?.type !== ROLE_TYPE.ADMIN"
prop="workspace_name"
:label="t('workspace.title')"
:min-width="180"
show-overflow-tooltip
class-name="border-l"
label-class-name="border-l"
:cell-style="{ borderLeftColor: 'var(--el-border-color)' }"
/>…or, if you only need a divider between column groups, drop the utility classes entirely and set it once via :cell-style on the column, or via a container class targeting td:nth-child(n).
style: system role member list