进一步完善shift多选

This commit is contained in:
buvta
2020-11-08 01:07:09 +08:00
parent 8f94a5604d
commit df3b43d8ac
2 changed files with 12 additions and 4 deletions

View File

@@ -198,7 +198,7 @@ export default {
})
},
selectionCellClick (selection, row) {
if (this.shiftDown && this.selectionBegin !== '') {
if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
this.selectionEnd = row.id
const start = Math.min(this.selectionBegin, this.selectionEnd) - 1
const end = Math.max(this.selectionBegin, this.selectionEnd)
@@ -209,7 +209,11 @@ export default {
this.selectionBegin = this.selectionEnd = ''
return
}
this.selectionBegin = row.id
if (selection.includes(row)) {
this.selectionBegin = row.id
} else {
this.selectionBegin = ''
}
},
handleSelectionChange (rows) {
this.multipleSelection = rows

View File

@@ -191,7 +191,7 @@ export default {
return a.group.localeCompare(b.group, 'zh')
},
selectionCellClick (selection, row) {
if (this.shiftDown && this.selectionBegin !== '') {
if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
this.selectionEnd = row.id
const start = Math.min(this.selectionBegin, this.selectionEnd) - 1
const end = Math.max(this.selectionBegin, this.selectionEnd)
@@ -202,7 +202,11 @@ export default {
this.selectionBegin = this.selectionEnd = ''
return
}
this.selectionBegin = row.id
if (selection.includes(row)) {
this.selectionBegin = row.id
} else {
this.selectionBegin = ''
}
},
handleSelectionChange (rows) {
this.multipleSelection = rows