1 换行(要控制第一行不能up,最后一行不能down)
changeRowDown(i){
console.log(i);
if(i != this.gridData.length-1){
var tempOption = this.gridData[i+1];
this.$set(this.gridData, i+ 1, this.gridData[i]);
this.$set(this.gridData, i,tempOption)
}
},
changeRowUp(i){
if(i!=0){
var tempOption = this.gridData[i-1];
this.$set(this.gridData, i-1, this.gridData[i]);
this.$set(this.gridData, i,tempOption)
}
},
2 禁用灰色
(控制部分情况按钮禁用,disble属性)
<el-button size="mini" class="bu-left" :class="{disable:scope.$index==0}" @click="changeRowUp(scope.$index)" type="text" icon="el-icon-arrow-up" circle></el-button>
<el-button size="mini" class="bu-left" :class="{disable:scope.$index==gridData.length-1}" @click="changeRowDown(scope.$index)" type="text" icon="el-icon-arrow-down" circle></el-button>
css
.bu-left{
float: left;
background-color:#409EFF ;
border-color:#409EFF;
color:#fff;
}
.bu-left.disable{
pointer-events: none;
background:#CFCFCF;
color:#fff;
border-color:#CFCFCF;
}