fix: 1. 降低搜索触发门槛为1位字符,支持单字母股票代码;2. 适配后端返回的小写字段,显示资产类型标签

This commit is contained in:
claw_bot 2026-03-09 10:33:36 +00:00
parent 6dbad69a8d
commit c10b951f4a

View File

@ -66,8 +66,11 @@
:key="idx"
@click="selectStock(result)"
>
<text class="item-ticker">{{ result.Ticker }}</text>
<text class="item-exchange">{{ result.Exchange }}</text>
<view class="item-left">
<text class="item-ticker">{{ result.ticker }}</text>
<text class="item-type" v-if="result.assetType">{{ result.assetType }}</text>
</view>
<text class="item-exchange">{{ result.exchange }}</text>
</view>
</view>
</view>
@ -134,7 +137,7 @@ const searchStock = async (keyword, stockIndex) => {
//
activeSearchIndex.value = stockIndex;
if (!keyword || keyword.length < 2) {
if (!keyword || keyword.length < 1) {
searchResults.value = [];
activeSearchIndex.value = -1;
return;
@ -160,7 +163,10 @@ const searchStock = async (keyword, stockIndex) => {
const selectStock = (result) => {
const stock = form.value.stocks[result.stockIndex];
if (stock) {
stock.name = result.Ticker;
stock.name = result.ticker;
//
stock.assetType = result.assetType;
stock.currency = result.priceCurrency;
}
searchResults.value = [];
activeSearchIndex.value = -1;
@ -514,12 +520,27 @@ onShow(async () => {
background-color: #F3F4F6;
}
.item-left {
display: flex;
flex-direction: row;
align-items: center;
gap: 12rpx;
}
.item-ticker {
font-size: 26rpx;
font-weight: 600;
color: #1F2937;
}
.item-type {
font-size: 18rpx;
color: #064E3B;
background-color: #D1FAE5;
padding: 2rpx 8rpx;
border-radius: 4rpx;
}
.item-exchange {
font-size: 22rpx;
color: #9CA3AF;