Skip to content

Commit

Permalink
我的自选基金新增支持s前缀搜索
Browse files Browse the repository at this point in the history
  • Loading branch information
adams549659584 committed Aug 19, 2020
1 parent 860c90a commit 2792697
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

### v1.3.8

- 我的自选基金新增支持s前缀搜索过滤自选基金,如s001071

### v1.3.8

- 更换使用说明gif链接

### v1.3.7
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "utools-fund",
"version": "v1.3.8",
"version": "v1.3.9",
"description": "自选基金助手",
"main": "main.ts",
"scripts": {
Expand All @@ -25,4 +25,4 @@
"dependencies": {
"axios": "^0.19.2"
}
}
}
9 changes: 8 additions & 1 deletion src/features/fundMy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,20 @@ utools.onPluginOut(() => {
const fundMy: TplFeature = {
mode: 'list',
args: {
placeholder: '输入持有份额,选择对应基金,回车键保存',
placeholder: '输入持有份额,选择对应基金,回车键保存,s前缀搜索',
enter: async (action, callbackSetList) => {
clearTimeout(QUERY_TIMER);
showFundDetails(callbackSetList);
},
search: async (action, searchWord, callbackSetList) => {
let dbList = CACHE_FUND_DB_LIST && CACHE_FUND_DB_LIST.length > 0 ? CACHE_FUND_DB_LIST : await getMyFundDetails();
if (searchWord && searchWord.startsWith('s')) {
searchWord = searchWord.substring(1);
const newDbList = dbList.filter(d => d.data.id.includes(searchWord) || d.data.name.includes(searchWord));
if (newDbList.length > 0) {
dbList = newDbList;
}
}
const cbList = fundDetailsToCbList(dbList, searchWord);
callbackSetList(cbList);
}, // 用户选择列表中某个条目时被调用
Expand Down

0 comments on commit 2792697

Please sign in to comment.