完善气站资源列表搜索契约
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -30,19 +30,17 @@ export function useResourceListSearch(
|
||||
);
|
||||
return displayFields.value.filter((field) => searchableKeys.has(field.key));
|
||||
});
|
||||
// 气站 API 仍支持通用关键字查询;缺少细粒度搜索契约时保留原搜索入口。
|
||||
const searchEnabled = computed(() => true);
|
||||
const searchEnabled = computed(() => searchableFields.value.length > 0);
|
||||
const searchPlaceholder = computed(
|
||||
() => searchableFields.value.length
|
||||
? `可搜索:${searchableFields.value
|
||||
.map((field) => field.listLabel ?? field.label)
|
||||
.join('、')}`
|
||||
: '关键字段模糊搜索',
|
||||
() =>
|
||||
`可搜索:${searchableFields.value
|
||||
.map((field) => field.listLabel ?? field.label)
|
||||
.join('、')}`,
|
||||
);
|
||||
|
||||
/** 仅在当前资源支持搜索时返回去除首尾空格的关键字。 */
|
||||
function requestKeyword() {
|
||||
return filters.keyword.trim();
|
||||
return searchEnabled.value ? filters.keyword.trim() : '';
|
||||
}
|
||||
|
||||
/** 将受支持的搜索状态写入 URL,并移除无效或陈旧的 keyword。 */
|
||||
|
||||
Reference in New Issue
Block a user