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

相关推荐
xxy-mm38 分钟前
Javascript 中的继承
开发语言·javascript·ecmascript
锋行天下2 小时前
公司内网部署大模型的探索之路
前端·人工智能·后端
1024肥宅3 小时前
手写 EventEmitter:深入理解发布订阅模式
前端·javascript·eventbus
EveryPossible4 小时前
google搜索框
vue.js
海市公约4 小时前
HTML网页开发从入门到精通:从标签到表单的完整指南
前端·ide·vscode·程序人生·架构·前端框架·html
3秒一个大4 小时前
HTML5 与 JavaScript 中的二进制数据处理:ArrayBuffer 与 TextEncoder/Decoder 实践
javascript
purpleseashell_Lili5 小时前
如何学习 AG-UI 和 CopilotKit
javascript·typescript·react
行云流水6265 小时前
前端树形结构实现勾选,半勾选,取消勾选。
前端·算法
diudiu_335 小时前
web漏洞--认证缺陷
java·前端·网络
阿珊和她的猫5 小时前
<video>` 和 `<audio>` 标签的常用属性解析
前端