網站首頁 編程語言 正文
<el-table
:data="dqList"
row-key="DQBM"
v-loading="listLoading"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
style="width: 100%;"
size="mini"
@cell-dblclick="quiteEdit"
border>
<el-table-column align="center" label="地區編碼" width="150px">
<template slot-scope="scope">
{{ scope.row.DQBM }}
</template>
</el-table-column>
<el-table-column align="center" width="180px" label="地區名稱" >
<template slot-scope="scope">
<el-input ref="DQMC"
v-model="scope.row.DQMC"
v-if="scope.row.DQBM === tabClickIndex && tabClickLabel === '地區名稱'" placeholder="地區名稱"
@blur="inputBlur(scope.row)">
</el-input>
<span v-else>{{ scope.row.DQMC }}</span>
</template>
</el-table-column>
<el-table-column align="center" width="200px" label="備注" show-overflow-tooltip>
<template slot-scope="scope">
<el-input ref="BZ"
v-model="scope.row.BZ"
v-if="scope.row.DQBM === tabClickIndex && tabClickLabel === '備注'" placeholder="備注"
@blur="inputBlur(scope.row)">
</el-input>
<span v-else>{{ scope.row.BZ }}</span>
</template>
</el-table-column>
</el-table>
export default {
data() {
return {
dqList:[],
listLoading:true,
tabClickIndex:null,
tabClickLabel:'',
}
},
methods: {
quiteEdit(row, column, cell, event){
switch (column.label) {
case '地區名稱':
this.tabClickIndex = row.DQBM
this.tabClickLabel = column.label
break
case '備注':
this.tabClickIndex = row.DQBM
this.tabClickLabel = column.label
break
default: return
}
},
// 失去焦點初始化
inputBlur(row) {
this.tabClickIndex = null
this.tabClickLabel = ''
//這里還可以進行其他數據提交等操作
}
}
}
以上是具體代碼,具體可以根據自己的項目情況進行調整修改
原文鏈接:https://blog.csdn.net/qq_38425904/article/details/120654173
相關推薦
- 2022-06-06 python?包之?threading?多線程_python
- 2022-09-27 C#中的const和readonly關鍵字詳解_C#教程
- 2022-09-15 Python實現圖形用戶界面計算器_python
- 2022-12-19 批處理bat腳本獲取打包發布問題記錄_DOS/BAT
- 2022-07-27 shell腳本中一鍵部署zookeeper集群服務的方法_linux shell
- 2022-10-13 C++?auto自動類型推導規則和使用詳解_C 語言
- 2022-01-03 Table表格怎么無限添加內容
- 2022-03-24 聊一聊redis奇葩數據類型與集群知識_Redis
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支