vue+Element实现table中点击及双击事件
单击事件<el-table@row-onclick="openDetails"></el-table>table表格中可有很多属性,这里只写我们要用到的功能,行单击事件script中写方法就可以了methods:{openDetails(row){this.row = row;this.$router.push({path:'/tabs',query:{dis:this.r
·
单击事件
<el-table
@row-click="openDetails"
>
</el-table>
table表格中可有很多属性,这里只写我们要用到的功能,行单击事件
script中写方法就可以了
methods:{
openDetails(row){
this.row = row;
this.$router.push({
path:'/tabs',
query:{dis:this.row.id}
});
},
}
上面写的方法是通过行id传递到**‘/tab’**页面,
详细看这篇vue中选中行数据传递到下个页面
双击事件
双击事件等同于单击事件,不过属性略有改变
<el-table
@row-dblclick="openDetails"
>
</el-table>
差别在哪?只是 row-click 与 row-dblclick
用起来很简单,但想不起来时是真的难!!
更多推荐
已为社区贡献1条内容
所有评论(0)