url 传参
Vercel Deploy / deploy (push) Successful in 1m0s

This commit is contained in:
2026-06-17 20:47:07 +08:00 Unverified
parent dd9efc2e4e
commit 1e7c84f91f
4 changed files with 24 additions and 20 deletions
+6 -5
View File
@@ -135,7 +135,7 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
resultsDiv.innerHTML = html;
}
function initializeSearchTermFromUrl() {
function applyQueryParams() {
const params = new URLSearchParams(window.location.search);
const presetTerm =
params.get('searchTerm') ||
@@ -147,10 +147,11 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
params.get('q') ||
'';
if (presetTerm) {
document.getElementById('searchTerm').value = presetTerm;
}
if (!presetTerm || !presetTerm.trim()) return;
document.getElementById('searchTerm').value = presetTerm.trim();
handleSearch();
}
document.getElementById('searchBtn').addEventListener('click', handleSearch);
initializeSearchTermFromUrl();
applyQueryParams();