el-table 修改某一列的单元格背景色

1. 案例

 2. 实现方法

 2.1 给单独某一列设置,首先:第一步想到的是用插槽。

 ps:最好是跟我一样,样式不要在这个上面写,先定一个变量。

2.2  定义变量

 2.3  在最开始绑定样式(咱就乖乖的用人家官网上的即可)

ps: columnIndex :列数,从0开始数 ,我这一列是 3

ps:tableCellStyle 是个方法名,不是个类名哦!!

 

// 在methods 里面写啊!!!

// 背景颜色处理
    tableCellStyle({ row, column, rowIndex, columnIndex }) {
      // console.log("背景色:");
      // console.log("row===:", row);
      // console.log("column===:", column);
      // console.log("rowIndex===:", rowIndex);
      // console.log("columnIndex===:", columnIndex);
      if (columnIndex === 1) {
        // 表格的第11行做处理
        if (row.state == "未维护") {
          // 如果是未维护 背景色蓝色,字体色白色
          return "background:#c7a027; color:#6c3a00";
        } else {
          return "background:yellow;color:#6c3a00";
        }
      } else if (columnIndex === 3) {
        this.numcolStyle =
          "background: rgb(117, 178, 229);
           display: block;
           width: 26px;
           height: 26px;
           color: rgb(255, 255, 255);
           padding: 3% 0px 0px;
           border-radius: 50%;
           margin:0 auto;";
      }
    },

当你在运行Armbian系统的设备上想要更换软件源(通常是为了加速下载或解决地区限制的问题),你可以按照下面的步骤操作: ### 更换Armbian系统默认源 #### 步骤一:备份原始文件 首先,你需要对现有的`sources.list`文件做一份副本。这可以帮助你在遇到问题的时候快速恢复。 ```bash sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak ``` #### 步骤二:编辑 sources 文件 接下来就是实际修改的地方了,我们打开 `sources.list` 进行编辑: ```bash sudo nano /etc/apt/sources.list ``` #### 步骤三:更改镜像地址 将原有的内容替换为你所选择的新镜像服务器URL,例如阿里云、清华大学等提供的国内镜像站点链接。对于大部分用户来说,可以考虑使用如下的清华源配置作为参考模板之一(假设你正在使用的Armbian版本基于Debian Buster): ```plaintext deb https://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free ``` 注意:如果你使用的是其他分支或是非官方库,则需要相应调整上述路径。 #### 步骤四:更新包索引并测试新源 保存并关闭文本编辑器之后,通过执行以下命令来让新的设置生效,并检查是否能正常工作: ```bash sudo apt-get update && sudo apt-get upgrade -y ``` 如果一切顺利的话,那么你就成功地完成了更换Armbian软件源的操作!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值