首页 > 其他分享 >el-table鼠标移入单元格进行数据填写更新

el-table鼠标移入单元格进行数据填写更新

时间:2023-09-21 09:03:03浏览次数:30  
标签:__ el style 单元格 cell item important input table

<el-table v-loading="loading" :data="npitestrecordList"  border @cell-mouse-enter="handleCellEnter" @cell-mouse-leave="handleCellLeave">   <el-table-column label="温度(°C)" align="left" prop="temper" show-overflow-tooltip width="125px">         <div class="item" slot-scope="scope">                 <el-input                   @blur="changeTemper(scope.row)"                   maxlength="9"                   class="item__input"                   v-model="scope.row.temper"                   placeholder="请输入温度(°C)"                 ></el-input>             <div class="item__txt">{{ scope.row.temper }}</div>         </div>   </el-table-column> </el-table>   data:这个数组代表的是移入哪个单元格有效果 editProp: [         "temper"       ],   methods: /** 鼠标移入cell */     handleCellEnter(row, column, cell, event) {     const property = column.property;   if(this.editProp.includes(property)){     cell.querySelector(".item__input").style.opacity = "1";             cell.querySelector(".item__input").style.width = "200px";               cell.querySelector(".item__input").style.height = "30px";             cell.querySelector(".item__input").style.display = "block";             cell.querySelector(".item__txt").style.display = "none";   }        },     /** 鼠标移出cell */     handleCellLeave(row, column, cell, event) {        const property = column.property;           if (this.editProp.includes(property)) {     cell.querySelector(".item__input").style.display = "none";               cell.querySelector(".item__txt").style.display = "block";           }     },   //更新数据 changeTemper(row){       // 只允许输入正整数或小数       const regex = /^[+]?(?!0\d)\d*(\.\d+)?$/;       if (!regex.test(row.temper)) {         // this.npitestrecordList[this.clickRowIndex].temperature = value.replace(/[^\d]/g, '');         this.msgError("湿度只允许输入正整数或小数,请重新输入");         return       }       //更新数据       let form = {         id: row.id,         temper: row.temper       }       updateNpitestrecord(form).then(response => {         if (response.code === 200) {           this.msgSuccess("修改成功");           // this.getList();         }       });     },   style: <style  lang='scss' scoped="scoped"> .item {   .input_padding {     padding-left: 0px !important;   }
  .el-input__inner {     color: #000000 !important;     height: 14px !important;     border-radius: 0px !important;     border-bottom: 1px solid #000000 !important;     border-top: 0px;     border-left: 0px;     border-right: 0px;     background-color: #ffffff !important;   }
  .item__txt {     box-sizing: border-box;     border: 1px solid transparent;     width: 100px;     line-height: 24px;     padding: 0 8px;   }   .item__txt--hover {     border: 1px solid #dddddd;     border-radius: 4px;     cursor: text;   }   .el-input--mini {     font-size: 13px !important;   }   i {     font-size: 13px !important;     line-height: 13px !important;   }   .item__input {     display: none;     width: 100px;   } }
.select_item{   // element.style {   //   width: 520px !important;   // }   div{       width:840px !important;     } } </style>    

标签:__,el,style,单元格,cell,item,important,input,table
From: https://www.cnblogs.com/cw828/p/17719032.html

相关文章

  • Parallel Programming Basic
    Learnaboutthedifferencebetweentime-efficiency(moreimportant)andwork-efficiencyparallelloopRelativeinstructionsetSSE(StreamingSIMDExtensions)instructionsetAVX(AdvancedVectorExtensions)instructionsetItisx86microprocessorinstruc......
  • SHELL编程开发:如何轻松一键部署Nginx脚本
    实现思路下载Nginx源码包解压源码包进入解压后的目录配置编译选项编译并安装Nginx启动Nginx服务代码实现以下是脚本内容及注释:#!/bin/bash#一键部署Nginx脚本#下载Nginx源码包wgethttp://nginx.org/download/nginx-1.20.1.tar.gz#解压源码包tar-zxvfnginx-1.20.1.tar.......
  • delphi JSON序列化(四)
    {TDateTimeConverter}functionTDateTimeConverter.CanConvert(ATypeInf:PTypeInfo):Boolean;beginResult:=True;end;functionTDateTimeConverter.ReadJson(constAReader:TJsonReader;ATypeInf:PTypeInfo;constAExistingValue:TValue;constASerial......
  • Metasploitable-Linux靶机配置
    Metasploitable和kali是课上下载好的。直接打开进入欢迎界面用默认账号登录了之后,修改root密码(sudopasswdroot),登录root账号,查看本机IP(ifconfig)切换到kali,把kali的IP改为192.168.72.129,且能ping通192.168.72.131在kali的浏览器中输入靶机的IP,可以看到靶机的界面......
  • 使用 Selenium 或其他工具模拟浏览器使用及语法代码
    使用Selenium模拟浏览器使用的代码示例如下:fromseleniumimportwebdriverfromselenium.webdriver.common.keysimportKeys#创建浏览器驱动实例driver=webdriver.Chrome()#打开网页driver.get("https://www.example.com")#查找并填写表单search_box=driver.f......
  • Selenium八大定位方法
    From: https://mp.weixin.qq.com/s/e0Kj7SrTRL_hP2fS5zPg2g-------------------------------------------------------------------------------------引言在使用Selenium进行Web自动化测试时,准确地定位元素是非常重要的一步。Selenium提供了多种元素定位方法,本文将深入探究这......
  • Farewell
    Fleetingtimedoesnotblurmymemoryofyou.Canitreallybe4yearssinceIfirstsawyou?Istillremember,vividly,onthebeautifulZhuhaiCampus,4yearsago,fromthemomentIsawyousmile,asyouwerewalkingoutoftheclassroomandturnedyour......
  • 在开启contenteditable可编辑div光标处插入图片
     $("#Content").focus();//创建img元素varimg=document.createElement('img');img.src='xxxx';img.style.display='block';//插入img元素if(window.getSelection){vareditableDiv=document.getEle......
  • 《Linux命令行与shell脚本编程大全.第3版》电子书PDF+源代码
    精通Linux命令行与shell脚本编程,尽在本书中本书是关于Linux命令行和shell命令的全面参考资料,涵盖详尽的动手教程和实际应用指南,并提供相关参考信息和背景资料,带你从Linux命令行基础入手,直到写出自己的shell。时隔四年后的这一版本,针对Linux的新特性和实践,进行了全面更新:使用......
  • ELK日志采集 - QuickStart
    目录架构选型ELKEFLKElasticsearchES集群搭建常用命令Filebeat功能介绍安装步骤Filebeat配置详解filebeat常用命令Logstash功能介绍安装步骤Input插件Filter插件GrokFilter插件MutateFilter插件常见的插件配置选项:MutateFilter配置案例:Output插件Kibana功能介绍安装步骤架构......