fix: 分类筛选改为单选(手机端操作优化)
This commit is contained in:
+21
-16
@@ -115,35 +115,40 @@ const handleRandom = async () => {
|
||||
}
|
||||
|
||||
const handleSelectType = (typeId) => {
|
||||
const ids = filterTypeIds.value
|
||||
const idx = ids.indexOf(typeId)
|
||||
if (idx >= 0) ids.splice(idx, 1)
|
||||
else ids.push(typeId)
|
||||
// 单选:点同一个取消,点别的切换
|
||||
if (filterTypeIds.value.length === 1 && filterTypeIds.value[0] === typeId) {
|
||||
filterTypeIds.value = []
|
||||
} else {
|
||||
filterTypeIds.value = [typeId]
|
||||
}
|
||||
filterCrowdIds.value = []
|
||||
const query = ids.length ? { type_ids: ids.join(',') } : {}
|
||||
const query = filterTypeIds.value.length ? { type_ids: filterTypeIds.value.join(',') } : {}
|
||||
router.push({ path: '/', query })
|
||||
}
|
||||
|
||||
const handleSelectCrowd = (crowdId) => {
|
||||
const ids = filterCrowdIds.value
|
||||
const idx = ids.indexOf(crowdId)
|
||||
if (idx >= 0) ids.splice(idx, 1)
|
||||
else ids.push(crowdId)
|
||||
// 单选:点同一个取消,点别的切换
|
||||
if (filterCrowdIds.value.length === 1 && filterCrowdIds.value[0] === crowdId) {
|
||||
filterCrowdIds.value = []
|
||||
} else {
|
||||
filterCrowdIds.value = [crowdId]
|
||||
}
|
||||
filterTypeIds.value = []
|
||||
const query = ids.length ? { crowd_ids: ids.join(',') } : {}
|
||||
const query = filterCrowdIds.value.length ? { crowd_ids: filterCrowdIds.value.join(',') } : {}
|
||||
router.push({ path: '/', query })
|
||||
// 移动端关闭菜单
|
||||
menuOpen.value = false
|
||||
}
|
||||
|
||||
// 抽屉菜单选择分类
|
||||
// 抽屉菜单选择分类(单选)
|
||||
const handleDrawerSelectType = (typeId) => {
|
||||
const ids = filterTypeIds.value
|
||||
const idx = ids.indexOf(typeId)
|
||||
if (idx >= 0) ids.splice(idx, 1)
|
||||
else ids.push(typeId)
|
||||
if (filterTypeIds.value.length === 1 && filterTypeIds.value[0] === typeId) {
|
||||
filterTypeIds.value = []
|
||||
} else {
|
||||
filterTypeIds.value = [typeId]
|
||||
}
|
||||
filterCrowdIds.value = []
|
||||
const query = ids.length ? { type_ids: ids.join(',') } : {}
|
||||
const query = filterTypeIds.value.length ? { type_ids: filterTypeIds.value.join(',') } : {}
|
||||
router.push({ path: '/', query })
|
||||
// 移动端关闭菜单
|
||||
menuOpen.value = false
|
||||
|
||||
Reference in New Issue
Block a user