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