Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ watch(
v-if="currentRole.type !== ROLE_TYPE.ADMIN"
prop="workspace_name"
:label="t('workspace.title')"
class-name="border-l!"
min-width="180"
show-overflow-tooltip
/>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-l only sets border-left-width. It relies on Element/Tailwind preflight for border-style and a sane border-color. With border-collapse: collapse on 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 bare border-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-style or a divider flag 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. Consider border-r on 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 border prop on el-table for full grids, or
  • Use the :cell-style / :header-cell-style function so the border is theme-driven (CSS variables like var(--el-border-color)) and respects dark mode automatically. Hard-coded utility colors won't follow el-table's dark-mode variables.

6. Minor nits

  • v-if="currentRole.type !== ROLE_TYPE.ADMIN" — fine, but if currentRole can be null/undefined during async load, this throws. Prefer currentRole?.type !== ROLE_TYPE.ADMIN or a computed.
  • prop="workspace_name" mixes snake_case with the camelCase used 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).

Expand Down
Loading