Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/vue/src/grid/src/table/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,25 @@ export function handleEscKeyDown({ event, actived, mouseConfig }) {

export function handleEnterKeyDown({ event, selected, actived }) {
const { highlightCurrentRow, currentRow, treeConfig } = this
let isLeftArrow = event.keyCode === 37
let isUpArrow = event.keyCode === 38
let isRightArrow = event.keyCode === 39
const isLeftArrow = event.keyCode === 37
const isUpArrow = event.keyCode === 38
const isRightArrow = event.keyCode === 39
// 如果是激活状态,退则出到下一行
if (selected.row || actived.row) {
this.moveSelected({
args: selected.row ? selected.args : actived.args,
isLeftArrow,
isUpArrow,
isRightArrow,
isDwArrow: true,
isDownArrow: true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修复拼写错误:将isDwArrow更正为isDownArrow,确保键盘事件的正确处理。

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix inconsistent down arrow key handling.

While other arrow keys are computed based on the event's keyCode, isDownArrow is hardcoded to true. This seems incorrect and might cause unexpected behavior.

Consider computing it like other arrow keys:

-      isDownArrow: true,
+      isDownArrow: event.keyCode === 40,

Committable suggestion skipped: line range outside the PR's diff.

event
})
} else if (treeConfig && highlightCurrentRow && currentRow) {
// 如果是树形表格当前行回车移动到子节点
let childrens = currentRow[treeConfig.children]
if (childrens && childrens.length) {
const children = currentRow[treeConfig.children]
if (children && children.length) {
event.preventDefault()
let targetRow = childrens[0]
const targetRow = children[0]
this.setTreeExpansion(currentRow, true)
.then(() => this.scrollToRow(targetRow))
.then(() => this.triggerCurrentRowEvent(event, { $table: this, row: targetRow }))
Expand Down
Loading