当前位置: 首页 > news >正文

Vue项目中使用element-plus的el-table组件-组件使用-样式修改

项目配置

<div class="table-wrap"><el-tableclass="table-card-container":data="tableData"style="width: 100%"><template v-for="column in tableColumn"><el-table-columnv-if="column.isShow":key="column.prop":prop="column.prop":label="column.label":fixed="column.fixed":width="column.width":align="column.align"><!-- :label="column.label" --><!-- <template #header></template> --><template #default="scope"><!-- <div v-if="column.label == '币种'" class="bz-icon"><img :src="getIcon(scope.row.bz)" />{{ scope.row.bz }}</div><div v-if="column.label == '价格(24h%)'"><span:class="{'long-color': +scope.row.jg24 >= 0,'short-color': +scope.row.jg24 < 0}">{{ formatValue(scope.row.jg24, 'zfb') }}</span></div> --></template></el-table-column></template></el-table></div>
const tableColumn = ref([{label: '排名',prop: 'pm',fixed: false,width: 80,isShow: true,align: 'center'},{label: '平台',prop: 'pt',fixed: false,width: 120,isShow: true,align: 'left'},{label: '持仓量',prop: 'ccl',fixed: false,width: 130,isShow: true,align: 'left'},{label: '持仓额',prop: 'cce',fixed: false,width: 130,isShow: true,align: 'left'},{label: '占比',prop: 'zb',fixed: false,width: 120,isShow: true,align: 'left'},{label: '持仓变化(1小时)',prop: 'ccbh1',fixed: false,width: 160,isShow: true,align: 'left'},{label: '持仓变化(4小时)',prop: 'ccbh4',fixed: false,width: 160,isShow: true,align: 'left'},{label: '持仓变化(24小时)',prop: 'ccbh24',fixed: false,width: 160,isShow: true,align: 'left'},{label: '持仓/24小时成交量',prop: 'cc24cjl',fixed: false,width: 160,isShow: true,align: 'right'}
]);
const tableData = [{pt: 'BTC',pm: '1',ccl: '123.32BTC',cce: '$131.32亿',zb: '1',ccbh1: '0.0032',ccbh4: '0.002',ccbh24: '0.0649',cc24cjl: '0.243243'}
];

样式重置修改文件

.table-card-container {@gray-bg: #080514;// --el-table-border: none;--el-table-border-color:#252525;--el-table-row-hover-bg-color:@gray-bg;
--el-fill-color-blank: @gray-bg;:deep(.el-table__header) {.el-table__cell {padding: 0;height: 50px;background: @gray-bg;font-family: PingFang SC;font-size: 14px;font-weight: 400;color: #868E9B;// &.ascending {//   .caret-wrapper {//     .sort-caret.ascending {//       border-bottom-color: #0ECB81;//     }//   }// }// &.descending {//   .caret-wrapper {//     .sort-caret.descending {//       border-top-color: #0ECB81;//     }//   }// }}}:deep(.el-table__body) {//   .el-table__row:nth-child(2n) {//     background: @gray-bg;//   }// .el-table__body{//   background: @gray-bg;// }.el-table__row {padding: 0;height: 60px;font-family: DIN,DIN-Medium, arial, sans-serif;font-size: 14px;color: #FFFFFF;--el-table-tr-bg-color: @gray-bg;.el-table__cell{--el-bg-color: @gray-bg;}}// .hover-row{//   --el-table-row-hover-bg-color:@gray-bg;// }}:deep(.el-table__body-wrapper) {background-color: @gray-bg;}:deep(.el-pagination) {--el-pagination-bg-color: #fff;--el-pagination-button-disabled-bg-color: transparent;--el-pagination-button-disabled-color: #868E9B;--el-pagination-hover-color: #0ECB81;--el-pagination-button-color: #868E9B;--el-pagination-font-size: 14px;font-family: DIN-Medium, arial, sans-serif;margin-top: 50px;justify-content: center;.btn-prev .el-icon,.btn-next .el-icon {font-size: 15px;}.el-pager {.number {margin: 0 8px}.is-active {background: #0ECB81;color: #fff;}}}}

单元格背景填充 

代码

<template><div class="TableList"><div class="title"><h1>数字货币合约爆仓图表</h1><div class="title-right"><el-input class="search-input" v-model="searchText" placeholder="搜索"><template #prefix><img src="@/assets/images/prices/search.svg" /></template></el-input></div></div><div class="table-wrap"><el-tableclass="table-card-container":data="tableData"style="width: 100%"><template v-for="column in tableColumn"><el-table-columnv-if="column.isShow":key="column.prop":prop="column.prop":label="column.label":fixed="column.fixed":width="column.width":align="column.align"><!-- :label="column.label" --><!-- <template #header></template> --><template #default="scope"><div v-if="column.label == '排名'" class="label-icon"><span>{{ scope.$index + 1 }}</span></div><div v-if="column.label == '币种'" class="label-icon"><img :src="getIcon(scope.row.bz)" /><span>{{ scope.row.bz }}</span></div><div v-if="column.label == '价格(24h%)'"><span:class="{'long-color': +scope.row.jg24 >= 0,'short-color': +scope.row.jg24 < 0}">{{ formatValue(scope.row.jg24, 'zfb') }}</span></div><divv-if="column.label == '1小时多单爆仓'"class="label-lty":class="{'long-bg-color': +scope.row.ddbc1s == 0,'short-bg-color': +scope.row.ddbc1s == 1}"><span>{{ scope.row.ddbc1 }}</span></div><divv-if="column.label == '1小时空单爆仓'"class="label-lty":class="{'long-bg-color': +scope.row.kdbc1s == 0,'short-bg-color': +scope.row.kdbc1s == 1}"><span>{{ scope.row.kdbc1 }}</span></div><divv-if="column.label == '4小时多单爆仓'"class="label-lty":class="{'long-bg-color': +scope.row.ddbc4s == 0,'short-bg-color': +scope.row.ddbc4s == 1}"><span>{{ scope.row.ddbc4 }}</span></div><divv-if="column.label == '4小时空单爆仓'"class="label-lty":class="{'long-bg-color': +scope.row.kdbc4s == 0,'short-bg-color': +scope.row.kdbc4s == 1}"><span>{{ scope.row.kdbc4 }}</span></div><divv-if="column.label == '24小时多单爆仓'"class="label-lty":class="{'long-bg-color': +scope.row.ddbc24s == 0,'short-bg-color': +scope.row.ddbc24s == 1}"><span>{{ scope.row.ddbc24 }}</span></div><divv-if="column.label == '24小时空单爆仓'"class="label-lty":class="{'long-bg-color': +scope.row.kdbc24s == 0,'short-bg-color': +scope.row.kdbc24s == 1}"><span>{{ scope.row.kdbc24 }}</span></div></template></el-table-column></template></el-table><div class="pagination"><ElPaginationv-model:current-page="page":page-size="pageSize":total="allTotalCount"layout="prev, pager, next"hide-on-single-page@current-change="onCurrentChange"/></div></div></div>
</template><script setup>
import { ref } from 'vue';
import {getIcon,getExchangeIcon,formatValue
} from '@/views/Prices/Hooks/useUtils.js';
const searchText = ref('');
const allTotalCount = ref(100);
const pageSize = ref(10);
const page = ref(1);
const onCurrentChange = (pageIdx) => {page.value = pageIdx;
};
const tableColumn = ref([{label: '排名',prop: 'pm',fixed: false,width: 70,isShow: true,align: 'left'},{label: '币种',prop: 'bz',fixed: false,width: 128,isShow: true,align: 'center'},{label: '价格',prop: 'jg',fixed: false,width: 120,isShow: true,align: 'left'},{label: '价格(24h%)',prop: 'jg24',fixed: false,width: 120,isShow: true,align: 'center'},{label: '1小时多单爆仓',prop: 'ddbc1',fixed: false,width: 130,isShow: true,align: 'center'},{label: '1小时空单爆仓',prop: 'kdbc1',fixed: false,width: 130,isShow: true,align: 'center'},{label: '4小时多单爆仓',prop: 'ddbc4',fixed: false,width: 130,isShow: true,align: 'center'},{label: '4小时空单爆仓',prop: 'kdbc4',fixed: false,width: 130,isShow: true,align: 'center'},{label: '24小时多单爆仓',prop: 'ddbc24',fixed: false,width: 130,isShow: true,align: 'center'},{label: '24小时空单爆仓',prop: 'kdbc24',fixed: false,width: 130,isShow: true,align: 'center'}
]);
const tableData = [{bz: 'ddd',jg: '$2342.1',jg24: '0.0023',ddbc1: '$2342.1万',ddbc1s: '1',kdbc1: '$2342.1万',kdbc1s: '0',ddbc4: '$2342.1万',ddbc4s: '0',kdbc4: '$2342.1万',kdbc4s: '1',ddbc24: '$2342.1万',ddbc24s: '1',kdbc24: '$2342.1万',kdbc24s: '1'},{bz: 'ddd',jg: '$2342.1',jg24: '0.0023',ddbc1: '$2342.1万',ddbc1s: '0',kdbc1: '$2342.1万',kdbc1s: '1',ddbc4: '$2342.1万',ddbc4s: '0',kdbc4: '$2342.1万',kdbc4s: '0',ddbc24: '$2342.1万',ddbc24s: '1',kdbc24: '$2342.1万',kdbc24s: '0'}
];
</script><style lang="less" scoped>
@import '../tableStyle2';
.TableList {.title {display: flex;justify-content: space-between;align-items: center;margin-bottom: 50px;h1 {color: #fff;font-family: PingFang SC;font-size: 24px;font-weight: 600;}.title-right {display: flex;.search-input {width: 225px;height: 40px;border-radius: 4px;border: 1px solid #404040;// margin-right: 15px;background: #121212;:deep(.el-input__inner) {color: #fff;}}}}.table-wrap {.table-card-container {:deep(.el-table__header) {.el-table__cell {.cell {padding: 0 4px;}}}:deep(.el-table__body) {.el-table__cell {.cell {padding: 0 4px;}}}}.label-icon {color: #fff;font-family: DIN;font-size: 14px;img {width: 16px;height: 16px;margin-right: 5px;vertical-align: text-top;}}.label-lty {height: 60px;line-height: 60px;}--table-bg-Short1: rgba(226, 98, 109, 0.2);--table-bg-Long1: rgba(14, 203, 129, 0.2);.long-bg-color {background: var(--table-bg-Long1);}.short-bg-color {background: var(--table-bg-Short1);}.pagination {padding-top: 30px;padding-bottom: 50px;}}
}
</style>

样式重置修改

.table-card-container {@gray-bg: transparent;//#18191e;// --el-table-border: none;--el-table-border-color: #252525;--el-table-row-hover-bg-color: @gray-bg;--el-fill-color-blank: @gray-bg;:deep(.el-table__header) {.el-table__cell {padding: 0;height: 50px;background: @gray-bg;font-family: PingFang SC;font-size: 14px;font-weight: 400;color: #868e9b;// &.ascending {//   .caret-wrapper {//     .sort-caret.ascending {//       border-bottom-color: #0ECB81;//     }//   }// }// &.descending {//   .caret-wrapper {//     .sort-caret.descending {//       border-top-color: #0ECB81;//     }//   }// }}}:deep(.el-table__body) {//   .el-table__row:nth-child(2n) {//     background: @gray-bg;//   }// .el-table__body{//   background: @gray-bg;// }.el-table__row {padding: 0;height: 60px;font-family: DIN,DIN-Medium, arial, sans-serif;font-size: 14px;color: #FFFFFF;--el-table-tr-bg-color: @gray-bg;.el-table__cell{padding: 0;--el-bg-color: @gray-bg;}}// .hover-row{//   --el-table-row-hover-bg-color:@gray-bg;// }}:deep(.el-table__body-wrapper) {background-color: @gray-bg;}:deep(.el-pagination) {--el-pagination-bg-color: #fff;--el-pagination-button-disabled-bg-color: transparent;--el-pagination-button-disabled-color: #868E9B;--el-pagination-hover-color: #0ECB81;--el-pagination-button-color: #868E9B;--el-pagination-font-size: 14px;font-family: DIN-Medium, arial, sans-serif;margin-top: 50px;justify-content: center;.btn-prev .el-icon,.btn-next .el-icon {font-size: 15px;}.el-pager {.number {margin: 0 8px}.is-active {background: #0ECB81;color: #fff;}}}}

相关文章:

Vue项目中使用element-plus的el-table组件-组件使用-样式修改

项目配置 <div class"table-wrap"><el-tableclass"table-card-container":data"tableData"style"width: 100%"><template v-for"column in tableColumn"><el-table-columnv-if"column.isShow&qu…...

JavaBean字符串训练(支票大写)

package 字符串练习;import java.util.Scanner;public class 人名币训练 {public static void main(String[] args) {/* 需求: 用户输入一个数字,改成发票那样的展示出来例子: 4321 -> 零佰零拾零万肆千叁佰贰拾壹元共七位(固定)*///思路: 1. 把用户读入的数字改写成大写,并…...

Java 核心技术卷 I —— 第2章 Java 编程环境

文章目录 2.1 安装 Java 开发工具包&#xff08;*&#xff09;2.2 使用命令行工具2.3 使用集成开发环境&#xff08;*&#xff09;2.4 JShell 2.1 安装 Java 开发工具包&#xff08;*&#xff09; 2.2 使用命令行工具 ​ 打开终端窗口&#xff0c;进入 Java 的 bin 目录&…...

外汇天眼:英国FCA引入新规定,强化金融广告审核标准!

英国金融行为监管局&#xff08;FCA&#xff09;为帮助人们做出明智的储蓄、投资和借贷决策&#xff0c;将引入新的筛选检查措施&#xff0c;针对那些批准金融广告的公司。 批准非受监管公司的金融营销的公司必须证明他们具备批准广告所需的技能和专业知识。那些签署广告批准的…...

【python】Seaborn画热力图,只显示第一行数字---seaborn与matplotlib版本问题

github上有这个讨论&#xff1a;Heatmap only has annotation text in the top row only Issue #3478 mwaskom/seaborn (github.com)翻译过来就是&#xff1a;热图仅在最上面一行有注释文本&#xff1b; 原因就是matplotlib 在2023年9月更新到了 3.8.0版本&#xff0c;改变了…...

VMware CentOS7 Docker入门

一、安装centos 1.引导安装 创建新的虚拟机-> 典型安装-> 安装程序光盘映像-> 命名虚拟机&#xff08;centos7.9,位置存放F:\Virtual Machines\CentOS 7.9&#xff09;-> 20GB,将虚拟磁盘存储为单个文件-> 自定义硬件4gb 4核-> NAT-> 2.启动安装 安装位置…...

C++ Primer 第5章 语句

C Primer 第5章 语句 5.1 简单语句一、空语句二、别漏写分号&#xff0c;也别多写分号三、复合语句&#xff08;块&#xff09; 5.2 语句作用域5.3 条件语句5.3.1 if语句一、使用if else语句二、嵌套if语句三、注意使用花括号四、悬垂else五、使用花括号控制执行路径 5.3.2 swi…...

【C++】bitset位图的简单模拟实现及常见面试题

文章目录 前言一、 bitset模拟实现二、 常见面试题1.给你一百亿个整数&#xff0c;找到只出现一次的数字2. 给两个文件&#xff0c;分别有100亿个整数&#xff0c;我们只有1G内存&#xff0c;如何找到两个文件交集&#xff1f; 前言 快速查找某个数据是否在一个集合中排序 去重…...

十六、MySql的MVCC机制CONNECT(收官!)

文章目录 一、数据库并发的场景有三种&#xff1a;二、读-写&#xff08;一&#xff09;3个记录隐藏列字段&#xff08;二&#xff09;undo 日志&#xff08;三&#xff09;模拟 MVCC&#xff08;四&#xff09;一些思考&#xff08;五&#xff09;Read View 一、数据库并发的场…...

194、SpringBoot -- 下载和安装 Erlang 、 RabbitMQ

本节要点&#xff1a; 一些命令&#xff1a; 小黑窗输入&#xff1a; rabbitmq-plugins enable rabbitmq_management 启动控制台插件 rabbitmq-server 启动rabbitMQ服务器 管理员启动小黑窗&#xff1a; rabbitmq-service install 添加rabbitMQ为本地服务 启动浏览器访问 ht…...

Linux0.11——第二回 从0x7c00到0x90000

上一讲&#xff0c;讲了CPU执行操作系统的最开始的两行代码&#xff1a; mov ax, 0x07c0 mov ds, ax这两行代码将数据段寄存器 ds 的值变成了 0x07c0&#xff0c;方便之后访问内存时&#xff0c;利用这个段基址进行寻址。 接下来的代码&#xff1a; mov ax,0x9000 mov es,ax…...

封装了一个中间放大效果的iOS轮播视图

效果图 计算逻辑 设定在中间展示的size&#xff0c;即正常size&#xff0c;然后设置水平和竖直方向上的margin, 在view的origin和scrollView的contentoffset相等的时候&#xff0c;即 视图处在正中间的时候&#xff0c;最大&#xff0c;然后通过计算其他视图的origin和scrollV…...

趣解设计模式之《小王的糖果售卖机》

〇、小故事 小王最近一直在寻找商机&#xff0c;他发现商场儿童乐园或者中小学校周围&#xff0c;会有很多小朋友喜欢吃糖果&#xff0c;那么他想设计一款糖果售卖机&#xff0c;让后将这些糖果售卖机布置到商场和学校旁边&#xff0c;这样就能获得源源不断的收益了。 想到这里…...

Redis 哨兵模式模式搭建教程

一、介绍 本文实战搭建一主两从三哨兵&#xff0c;通过使用哨兵模式&#xff0c;可以有效避免某台服务器的 Redis 挂掉出现的不可用问题&#xff0c;保障系统的高可用。 本文通过虚拟机搭建的三台 Centos7 服务器进行测试&#xff0c;使用的 Redis 版本为 6.25。 二、准备环…...

41. Linux系统配置FTP服务器并在QT中使用QFtp实现文件上传

1. 说明 这篇博客主要记录一些在Linux系统中搭建FTP服务器时踩过的一些坑,以及在使用QFtp上传文件时需要注意的问题。 2. FTP环境搭建 在linux系统中,需要安装vsftpd,可以在终端中输入下面的命令进行安装: sudo apt-get install vsftpd使用上述命令安装后,系统中会有一…...

【新版】系统架构设计师 - 案例分析 - 架构设计<架构风格和质量属性>

个人总结&#xff0c;仅供参考&#xff0c;欢迎加好友一起讨论 文章目录 架构 - 案例分析 - 架构设计&#xff1c;架构风格和质量属性&#xff1e;例题1例题2例题3例题4例题5例题6 架构 - 案例分析 - 架构设计&#xff1c;架构风格和质量属性&#xff1e; 例题1 某软件公司为…...

C++ - 红黑树 介绍 和 实现

前言 前面 学习了 AVL树&#xff0c;AVL树虽然在 查找方面始终拥有 O(log N &#xff09;的极高效率&#xff0c;但是&#xff0c;AVL 树在插入 ,删除等等 修改的操作当中非常的麻烦&#xff0c;尤其是 删除操作&#xff0c;在实现当中细节非常多&#xff0c;在实现上非常难掌控…...

【蓝桥杯选拔赛真题62】Scratch判断小球 少儿编程scratch图形化编程 蓝桥杯选拔赛真题解析

目录 scratch判断小球 一、题目要求 编程实现 二、案例分析 1、角色分析...

Spring面试题15:Spring支持几种bean的作用域?singleton、prototype、request的区别是什么?

该文章专注于面试,面试只要回答关键点即可,不需要对框架有非常深入的回答,如果你想应付面试,是足够了,抓住关键点 面试官:Spring支持几种bean的作用域? Spring支持以下几种Bean的作用域: Singleton(单例):这是Spring默认的作用域。使用@Scope(“singleton”)注解或…...

Spring Boot中Tomcat服务器参数解析及高并发控制

Spring Boot中Tomcat服务器参数解析及高并发控制 Spring Boot 集成了多种服务器&#xff0c;默认使用了Tomcat 服务器。在高并发情况下&#xff0c;合理地配置 Tomcat 服务器参数对于控制请求量和提高系统的稳定性至关重要。本文将解释 Spring Boot 中涉及 Tomcat 服务器的一些…...

UDP(Echoserver)

网络命令 Ping 命令 检测网络是否连通 使用方法: ping -c 次数 网址ping -c 3 www.baidu.comnetstat 命令 netstat 是一个用来查看网络状态的重要工具. 语法&#xff1a;netstat [选项] 功能&#xff1a;查看网络状态 常用选项&#xff1a; n 拒绝显示别名&#…...

Go 语言接口详解

Go 语言接口详解 核心概念 接口定义 在 Go 语言中&#xff0c;接口是一种抽象类型&#xff0c;它定义了一组方法的集合&#xff1a; // 定义接口 type Shape interface {Area() float64Perimeter() float64 } 接口实现 Go 接口的实现是隐式的&#xff1a; // 矩形结构体…...

GitHub 趋势日报 (2025年06月08日)

&#x1f4ca; 由 TrendForge 系统生成 | &#x1f310; https://trendforge.devlive.org/ &#x1f310; 本日报中的项目描述已自动翻译为中文 &#x1f4c8; 今日获星趋势图 今日获星趋势图 884 cognee 566 dify 414 HumanSystemOptimization 414 omni-tools 321 note-gen …...

[Java恶补day16] 238.除自身以外数组的乘积

给你一个整数数组 nums&#xff0c;返回 数组 answer &#xff0c;其中 answer[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积 。 题目数据 保证 数组 nums之中任意元素的全部前缀元素和后缀的乘积都在 32 位 整数范围内。 请 不要使用除法&#xff0c;且在 O(n) 时间复杂度…...

招商蛇口 | 执笔CID,启幕低密生活新境

作为中国城市生长的力量&#xff0c;招商蛇口以“美好生活承载者”为使命&#xff0c;深耕全球111座城市&#xff0c;以央企担当匠造时代理想人居。从深圳湾的开拓基因到西安高新CID的战略落子&#xff0c;招商蛇口始终与城市发展同频共振&#xff0c;以建筑诠释对土地与生活的…...

计算机基础知识解析:从应用到架构的全面拆解

目录 前言 1、 计算机的应用领域&#xff1a;无处不在的数字助手 2、 计算机的进化史&#xff1a;从算盘到量子计算 3、计算机的分类&#xff1a;不止 “台式机和笔记本” 4、计算机的组件&#xff1a;硬件与软件的协同 4.1 硬件&#xff1a;五大核心部件 4.2 软件&#…...

人工智能--安全大模型训练计划:基于Fine-tuning + LLM Agent

安全大模型训练计划&#xff1a;基于Fine-tuning LLM Agent 1. 构建高质量安全数据集 目标&#xff1a;为安全大模型创建高质量、去偏、符合伦理的训练数据集&#xff0c;涵盖安全相关任务&#xff08;如有害内容检测、隐私保护、道德推理等&#xff09;。 1.1 数据收集 描…...

Golang——7、包与接口详解

包与接口详解 1、Golang包详解1.1、Golang中包的定义和介绍1.2、Golang包管理工具go mod1.3、Golang中自定义包1.4、Golang中使用第三包1.5、init函数 2、接口详解2.1、接口的定义2.2、空接口2.3、类型断言2.4、结构体值接收者和指针接收者实现接口的区别2.5、一个结构体实现多…...

【深度学习新浪潮】什么是credit assignment problem?

Credit Assignment Problem(信用分配问题) 是机器学习,尤其是强化学习(RL)中的核心挑战之一,指的是如何将最终的奖励或惩罚准确地分配给导致该结果的各个中间动作或决策。在序列决策任务中,智能体执行一系列动作后获得一个最终奖励,但每个动作对最终结果的贡献程度往往…...

【iOS】 Block再学习

iOS Block再学习 文章目录 iOS Block再学习前言Block的三种类型__ NSGlobalBlock____ NSMallocBlock____ NSStackBlock__小结 Block底层分析Block的结构捕获自由变量捕获全局(静态)变量捕获静态变量__block修饰符forwarding指针 Block的copy时机block作为函数返回值将block赋给…...