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

相关推荐
IT_陈寒2 小时前
Redis内存暴涨,没想到是AOF重写捣的鬼
前端·人工智能·后端
ikoala2 小时前
让 Codex 自己查账:一个省 token 的小技巧
前端·后端·ai编程
ikoala2 小时前
AI 写页面像说明书,修 Bug 像贴膏药?把这两句话写进 AGENTS.md
前端·javascript·ai编程
Penge6662 小时前
《Go 后端开发者学 TypeScript:ES Module了解》
javascript
Penge6662 小时前
《Go 后端开发者学 TypeScript:从零搭建与运行》
javascript
Penge6663 小时前
《Go 后端开发者学 TypeScript:keyof关键字》
javascript
Penge6664 小时前
《Go 后端开发者学 TypeScript:extends关键字》
javascript
张张123y4 小时前
DSH 插件调试避坑:client.js 设置面板、热重载与高频报错排查表
开发语言·javascript·人工智能·开源·ecmascript·后端开发·ai agent
去伪存真4 小时前
AI Agent Harness 深度测评与技术选型实战
前端·agent
FRing037 小时前
vue2干货总结7(自定义指令、插槽、单页应用程序、路由的使用(VueRouter))
开发语言·前端·vue.js·vue2