fix: 修复股票搜索下拉不显示问题,增加activeSearchIndex赋值

This commit is contained in:
claw_bot 2026-03-09 09:59:41 +00:00
parent 8d9619b51d
commit 6dbad69a8d

View File

@ -131,6 +131,9 @@ const searchTimer = ref(null);
const searchStock = async (keyword, stockIndex) => { const searchStock = async (keyword, stockIndex) => {
// //
if (searchTimer.value) clearTimeout(searchTimer.value); if (searchTimer.value) clearTimeout(searchTimer.value);
//
activeSearchIndex.value = stockIndex;
if (!keyword || keyword.length < 2) { if (!keyword || keyword.length < 2) {
searchResults.value = []; searchResults.value = [];
activeSearchIndex.value = -1; activeSearchIndex.value = -1;
@ -149,6 +152,7 @@ const searchStock = async (keyword, stockIndex) => {
} catch (err) { } catch (err) {
console.error('搜索股票失败:', err); console.error('搜索股票失败:', err);
searchResults.value = []; searchResults.value = [];
activeSearchIndex.value = -1;
} }
}, 300); }, 300);
}; };