fix:添加时最新一行可选择在第一行或者最后一行

This commit is contained in:
shijing 2025-04-25 16:02:57 +08:00
parent 4c5f393a2d
commit 831c33cb98
1 changed files with 8 additions and 2 deletions

View File

@ -49,7 +49,8 @@
dragSort: { type: Boolean, default: false },
hideAdd: { type: Boolean, default: false },
hideDelete: { type: Boolean, default: false },
hideIndex: { type: Boolean, default: false }
hideIndex: { type: Boolean, default: false },
pushType: { type: String, default: 'push' }
},
data(){
return {
@ -99,7 +100,12 @@
},
rowAdd(){
const temp = JSON.parse(JSON.stringify(this.addTemplate))
this.data.push(temp)
if(this.pushType=='push'){
this.data.push(temp)
}else if(this.pushType=='unshift'){
this.data.unshift(temp)
}
},
rowDel(row, index){
this.data.splice(index, 1)