美文网首页
element-ui 某列单元格 点击复制

element-ui 某列单元格 点击复制

作者: 懿小诺 | 来源:发表于2021-07-16 14:37 被阅读0次

1.某列点击事件 会发现在 <el-table-column>里设置click没响应

于是,改用table的cell-click方法 column.property 对应的是prop绑定的值 指定某列

cellClick(row, column, cell, event) {    
      if (column.property == "appId") {
               this.copyAppid(row)
      }
 },

接着是复制方法

使用clipboard2插件的copyText方法

  copyAppid(row) {
            this.$copyText(row.appId).then( (e) => {
                this.$message.success('复制成功')
            }, (e) => {
                this.$message.error('复制失败!')
            })
    },

相关文章

网友评论

      本文标题:element-ui 某列单元格 点击复制

      本文链接:https://www.haomeiwen.com/subject/sckbpltx.html