完善测试建表并统一前端格式
This commit is contained in:
@@ -52,7 +52,14 @@ export function readQueryNumber(query: LocationQuery | LocationQueryRaw, key: st
|
||||
export function readQueryCSV(query: LocationQuery | LocationQueryRaw, key: string): string[] {
|
||||
const raw = readQueryString(query, key)
|
||||
if (!raw) return []
|
||||
return [...new Set(raw.split(',').map(item => item.trim()).filter(Boolean))]
|
||||
return [
|
||||
...new Set(
|
||||
raw
|
||||
.split(',')
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
/** 将多选数组序列化为 CSV;空数组返回 undefined 以便从 query 中省略。 */
|
||||
|
||||
@@ -134,11 +134,7 @@ export function useHomeFilters(
|
||||
}
|
||||
|
||||
function setStringFilter(key: StringFilterKey, value: string | string[]) {
|
||||
filters[key] = Array.isArray(value)
|
||||
? uniqueOptions(value)
|
||||
: value.trim()
|
||||
? [value.trim()]
|
||||
: []
|
||||
filters[key] = Array.isArray(value) ? uniqueOptions(value) : value.trim() ? [value.trim()] : []
|
||||
closeFilterPopover()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user