Vue click on a row of the table to make it top

My usage scenario here is to click on a row to use, and the data of that row will be adjusted and displayed on the first row
Insert picture description here

//给使用按钮添加方法,方法如下
use(row) {
    
    
	let values = this.tableData;//这个是表格数据
	let value = row;
	let res = [value].concat(values.filter(item => item != value));//concat() 方法用于连接两个或多个数组
	console.log(res);
	this.tableData = res;
}

Guess you like

Origin blog.csdn.net/GongWei_/article/details/110947575