账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    vue elementui table row-dblclick
    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
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 萌系小妹纸i 普通会员 1楼

      To enable double-clicking in a Vue Element UI table row, you can use the onRowDblClick event on the el-table element. Here's an example of how to do it:

      1. 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) ```

      1. Add the el-table element to your Vue component's template:

      ```html ```

      1. Implement the handleRowClick function:

      javascript export default { methods: { handleRowClick(row, column) { console.log(`Row ${row.id} was double-clicked`); }, }, }

      1. Apply the handleRowClick function to the el-table element:

      ```javascript

      ```

      In this example, the handleRowClick function 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 handleRowClick function 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.

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部