fix: 微信小程序搜索功能简化

- detail.vue: 小程序中隐藏搜索下拉列表,买入时直接输入代码
- 小程序不触发搜索接口调用,提升性能
- H5/APP保持完整搜索功能
This commit is contained in:
claw_bot 2026-03-13 08:04:00 +00:00
parent e7a3f1d26c
commit 5671f7a618

View File

@ -278,6 +278,7 @@
@click="handleStockInputClick" @click="handleStockInputClick"
/> />
<!-- #endif --> <!-- #endif -->
<!-- #ifdef H5 || APP-PLUS -->
<!-- 搜索下拉列表 --> <!-- 搜索下拉列表 -->
<view class="search-dropdown" v-if="searchResults.length > 0"> <view class="search-dropdown" v-if="searchResults.length > 0">
<view <view
@ -296,6 +297,7 @@
</view> </view>
</view> </view>
</view> </view>
<!-- #endif -->
</view> </view>
</view> </view>
@ -456,6 +458,7 @@ const searchResults = ref([]);
const searchTimer = ref(null); const searchTimer = ref(null);
const handleStockInputClick = () => { const handleStockInputClick = () => {
// #ifdef H5 || APP-PLUS
if (transactionType.value === 'sell') { if (transactionType.value === 'sell') {
searchResults.value = positions.value.map(pos => ({ searchResults.value = positions.value.map(pos => ({
ticker: pos.stockCode, ticker: pos.stockCode,
@ -471,9 +474,14 @@ const handleStockInputClick = () => {
}; };
const onStockInput = (e) => { const onStockInput = (e) => {
// #ifdef H5 || APP-PLUS
const keyword = e.detail.value; const keyword = e.detail.value;
console.log('🔍 股票输入:', keyword); console.log('🔍 股票输入:', keyword);
searchStock(keyword); searchStock(keyword);
// #endif
// #ifdef MP-WEIXIN
//
// #endif
}; };
const searchStock = async (keyword) => { const searchStock = async (keyword) => {