From 258d92ac1c5058d3765a7de6ed26135001a18996 Mon Sep 17 00:00:00 2001 From: claw_bot Date: Fri, 13 Mar 2026 06:18:56 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=82=A1=E7=A5=A8?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将u-input替换为原生input,解决事件参数问题 - 添加onStockInput方法正确处理input事件 - 添加调试日志便于排查问题 --- pages/detail/detail.vue | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index 60339f7..9e8f422 100755 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -197,13 +197,12 @@ {{ transactionType === 'sell' ? '选择持仓' : '股票代码' }} - @@ -351,7 +350,6 @@ const searchTimer = ref(null); const handleStockInputClick = () => { if (transactionType.value === 'sell') { - // 卖出时显示当前持仓列表 searchResults.value = positions.value.map(pos => ({ ticker: pos.stockCode, stockCode: pos.stockCode, @@ -365,8 +363,14 @@ const handleStockInputClick = () => { } }; +const onStockInput = (e) => { + const keyword = e.detail.value; + console.log('🔍 股票输入:', keyword); + searchStock(keyword); +}; + const searchStock = async (keyword) => { - // 防抖 + console.log('🔍 searchStock 调用:', keyword); if (searchTimer.value) clearTimeout(searchTimer.value); if (!keyword || keyword.length < 1) { searchResults.value = []; @@ -375,7 +379,9 @@ const searchStock = async (keyword) => { searchTimer.value = setTimeout(async () => { try { + console.log('📤 调用 api.ticker.search:', keyword); const res = await api.ticker.search(keyword); + console.log('📥 搜索结果:', res); if (res.code === 200) { searchResults.value = res.data; } @@ -822,6 +828,18 @@ const deletePortfolio = async () => { margin-bottom: 12rpx; } +.stock-input { + width: 100%; + height: 80rpx; + background-color: #F9FAFB; + border: 2rpx solid #E5E7EB; + border-radius: 16rpx; + padding: 0 20rpx; + font-size: 26rpx; + color: #1F2937; + box-sizing: border-box; +} + .form-select { width: 100%; height: 80rpx;