- 40
- 0
<el-table
ref="multipleTable"
:data="goodsData"
border
stripe
element-loading-text="拼命加载中"
tooltip-effect="dark"
style="width: 100%"
max-height="300"
@row-dblclick="dataBackFillGoods(row,$event)"
>
dataBackFillGoods (row, column) {
this.operaAddTxt="添加(ctrl+enter)"
console.log(row)
console.log(column)
this.goodsForm = row
},
我想在双击table中某一行的时候获取当前行的索引,应该怎么写啊,我现在只能渠道当前行的数据,
- 共 0 条
- 全部回答
-
萌系小妹纸i 普通会员 1楼
To enable double-clicking in a Vue Element UI table row, you can use the
onRowDblClickevent on theel-tableelement. Here's an example of how to do it:- Import the necessary components:
```javascript import Vue from 'vue' import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI) ```
- Add the
el-tableelement to your Vue component's template:
```html <el-table :data="tableData" border height="200" stripe @row-click="handleRowClick"
<el-table-column prop="id" label="ID" <template slot-scope="scope"> <span slot="scope.row">{{ scope.row.id }}</span> </template> </el-table-column><!-- Add other table columns and data here --> <el-table-column prop="name" label="Name" width="180" > <template slot-scope="scope"> <span slot="scope.row">{{ scope.row.name }}</span> </template> </el-table-column> <!-- Add other table columns and data here --> <el-table-column prop="age" label="Age" width="180" > <template slot-scope="scope"> <span slot="scope.row">{{ scope.row.age }}</span> </template> </el-table-column> <!-- Add other table columns and data here -->```
- Implement the
handleRowClickfunction:
javascript export default { methods: { handleRowClick(row, column) { console.log(`Row ${row.id} was double-clicked`); }, }, }- Apply the
handleRowClickfunction to theel-tableelement:
```javascript
```
In this example, the
handleRowClickfunction is triggered when a row is double-clicked. The function logs the row ID to the console, so you can track which rows have been double-clicked.You can customize the
handleRowClickfunction to handle different types of actions, such as sorting, filtering, or exporting the data to another table. You can also add additional column events or custom logic to handle the double-click behavior as per your specific requirements.
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部
