Vue3框架中让table合计居中对齐

第一步:给它加一个类名 center-table 如下:

html 复制代码
 <el-table
      :data="datas.shows"
      max-height="600px"
      show-summary
      stripe
      border
      style="width: 100%"
      :header-cell-style="{ textAlign: 'center' }"
      :cell-style="{ textAlign: 'center' }"
      class="center-table"
    ></el-table>

第二步: 使用v-deep选择器

css 复制代码
:deep(.center-table td), 
:deep(.center-table th) {
  text-align: center !important;
}

效果

原创作者:吴小糖

创作时间:2023.11.24

相关推荐
YHHLAI5 分钟前
告别传统开发!Bun + TS 解锁前端新体验
前端
qq43569470110 分钟前
Vue01
vue.js
拾年27513 分钟前
Bun:重新定义 JavaScript 运行时 - 为什么它可能是 Node.js 的终结者?
javascript·typescript·bun
vim怎么退出14 分钟前
Dive into React——调度/并发
前端·react.js·源码阅读
秋天的一阵风16 分钟前
AGENTS.md:你的AI代码助手,需要一份"项目说明书"
前端·后端·ai编程
rising start18 分钟前
七、Vue Router
前端·vue.js·router
羊羊小栈20 分钟前
停车场管理系统(基于前后端Web开发)
前端·人工智能·毕业设计·大作业
数据知道20 分钟前
网站到底是如何通过JS读取你的浏览器指纹的?
开发语言·javascript·ecmascript·指纹浏览器
用户9385156350723 分钟前
从JS的“坑”到TS的“墙”,再到Bun与AI:打造健壮的全栈应用
前端·javascript
jserTang25 分钟前
手撕 Claude Code-7:自动压缩与记忆恢复
前端·后端