feat: auto-scroll to bottom when adding a new row in DataGrid

This commit is contained in:
t8y2
2026-04-29 20:49:13 +08:00
parent b976d5c06d
commit d26173e0eb
3 changed files with 7 additions and 0 deletions
+2
View File
@@ -20,6 +20,7 @@ import { useConnectionStore } from "@/stores/connectionStore";
import { useQueryStore } from "@/stores/queryStore";
import { useHistoryStore } from "@/stores/historyStore";
import { setLocale, currentLocale, type Locale } from "@/i18n";
import { getCurrentWindow, type Theme } from "@tauri-apps/api/window";
import * as api from "@/lib/tauri";
const { t } = useI18n();
@@ -187,6 +188,7 @@ const isDark = ref(localStorage.getItem("dbx-theme") === "dark");
function applyTheme() {
document.documentElement.classList.toggle("dark", isDark.value);
getCurrentWindow().setTheme(isDark.value ? "dark" as Theme : "light" as Theme);
}
function toggleTheme() {
+4
View File
@@ -315,6 +315,10 @@ function onEditKeydown(e: KeyboardEvent) {
function addRow() {
newRows.value.push(props.result.columns.map(() => null));
nextTick(() => {
const el = getScrollerElement();
if (el) el.scrollTop = el.scrollHeight;
});
}
function deleteSelectedRow() {