網站首頁 編程語言 正文
項目場景:
項目中有時候需要使用element中el-table設置type="expand"展開行,但是需要隱藏小箭頭,點擊某個地方展開行,如下所示:
實現方法:
使用 type="expand"
可以開啟展開行功能,使用 width="1"
可以隱藏展開行的小箭頭。
<el-table-column
type="expand"
width="1">
<template slot-scope="scope">
<el-input
type="textarea"
:rows="10"
v-model="scope.row.policyDoc">
</el-input>
</template>
</el-table-column>
但是發現沒有完全隱藏小箭頭,如下所示:
解決方法是,修改為 width="5"
便可。
仍有點小瑕疵。請網友提供更好的解決辦法。
附加功能:列表單選、點擊名稱展開行:
<el-table
:data="tableData"
ref="tableObj"
:stripe="true"
@row-click = "showRow">
<el-table-column
type="expand"
width="5">
<template slot-scope="scope">
<el-input
type="textarea"
:rows="10"
v-model="scope.row.policyDoc">
</el-input>
</template>
</el-table-column>
<!-- 單選 -->
<el-table-column
width="40">
<template slot-scope="scope">
<el-radio class="radio" :label="scope.row" v-model="radio" @change.native="getCurrentRow(scope.row)" > </el-radio>
</template>
</el-table-column>
<el-table-column
prop="name"
label="名稱"
show-overflow-tooltip>
<template slot-scope="scope">
<el-button @click="toogleExpand(scope.row)" type="text">{{scope.row.name}}</el-button>
</template>
</el-table-column>
</el-table>
radio: '',
policyData: {},
//row-click 當某一行被點擊時會觸發該事件 row, event, column(可不用)
showRow(row) {
//賦值給radio
console.log(row);
},
//獲取選中行的數據
getCurrentRow(val) {
this.policyData = val;
},
//點擊可展開項
toogleExpand(row) {
let table = this.$refs.tableObj;
table.toggleRowExpansion(row);
},
原文鏈接:https://blog.csdn.net/migexiaoliang/article/details/126071981
相關推薦
- 2022-08-16 C語言詳細分析浮點數在內存中的儲存_C 語言
- 2022-04-11 Python寫一個簡單的在線編輯器_python
- 2022-01-28 Hyper集成laravel中使用的blade模板
- 2022-06-20 基于C#實現語音識別功能詳解_C#教程
- 2022-05-22 KVM?介紹及作用詳解_Kvm
- 2022-10-01 React構建簡潔強大可擴展的前端項目架構_React
- 2024-02-28 自定義類模擬BufferedReader的readLine()功能
- 2022-01-21 有了 IP 地址,為什么還要用 MAC 地址?
- 最近更新
-
- 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同步修改后的遠程分支