✨ feat(分类): 多选标签变单选标签
This commit is contained in:
parent
c100d2bcd0
commit
8f065076aa
@ -1,10 +1,10 @@
|
||||
// export const BASE_URL = CURRENT_BASE_URL
|
||||
export const BASE_URL = CURRENT_BASE_URL
|
||||
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
||||
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
||||
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
||||
// export const BASE_URL = `http://192.168.0.89:40001/lymarket`
|
||||
// export const BASE_URL = 'https://test.zzfzyc.com/lymarket' // 测试环境
|
||||
export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布
|
||||
// export const BASE_URL = 'https://pre.zzfzyc.com/lymarket' // 预发布
|
||||
// export const BASE_URL = 'https://dev.zzfzyc.com/lymarket' // 开发环境
|
||||
// export const BASE_URL = 'https://www.zzfzyc.com/lymarket' // 正式环境
|
||||
// export const BASE_URL = 'http://192.168.1.7:50002/lymarket' // 添
|
||||
|
||||
@ -68,14 +68,15 @@ const Filter = (props: params) => {
|
||||
return {
|
||||
...prev,
|
||||
label_ids: (() => {
|
||||
if (prev.label_ids.includes(id)) {
|
||||
const index = prev.label_ids.findIndex(item => item === id)
|
||||
prev.label_ids.splice(index, 1)
|
||||
return prev.label_ids
|
||||
}
|
||||
else {
|
||||
return [...prev.label_ids, id]
|
||||
}
|
||||
// if (prev.label_ids.includes(id)) {
|
||||
// const index = prev.label_ids.findIndex(item => item === id)
|
||||
// prev.label_ids.splice(index, 1)
|
||||
// return prev.label_ids
|
||||
// }
|
||||
// else {
|
||||
// return [...prev.label_ids, id]
|
||||
// }
|
||||
return [id] // 单选
|
||||
})(),
|
||||
}
|
||||
})
|
||||
|
||||
@ -29,15 +29,17 @@ export default ({ list = [], defaultValue = [], onClickTag }: Params) => {
|
||||
const multipleSelection = useRef<number[]>([])
|
||||
|
||||
const clickEvent = (item: ListProps) => {
|
||||
if (multipleSelection.current.includes(item.id)) {
|
||||
const index = multipleSelection.current.findIndex(id => id === item.id)
|
||||
multipleSelection.current.splice(index, 1)
|
||||
}
|
||||
else {
|
||||
multipleSelection.current.push(item.id)
|
||||
}
|
||||
console.log(item, multipleSelection.current)
|
||||
onClickTag?.(multipleSelection.current)
|
||||
console.log('clickEvent', item)
|
||||
// if (multipleSelection.current.includes(item.id)) {
|
||||
// const index = multipleSelection.current.findIndex(id => id === item.id)
|
||||
// multipleSelection.current.splice(index, 1)
|
||||
// }
|
||||
// else {
|
||||
// multipleSelection.current.push(item.id)
|
||||
// }
|
||||
// console.log(item, multipleSelection.current)
|
||||
multipleSelection.current = [item.id]
|
||||
onClickTag?.([item.id])
|
||||
setTabId(item.id)
|
||||
}
|
||||
return (
|
||||
|
||||
@ -38,7 +38,10 @@ export default () => {
|
||||
await getAllLabel()
|
||||
if (router.params.pageJump) {
|
||||
const res = await fetchData({ page_jump: router.params.pageJump || 1 })
|
||||
const labelIds = res.data.list.map(item => item.product_label_id)
|
||||
let labelIds = res.data.list.map(item => item.product_label_id)
|
||||
if (labelIds.length > 0) {
|
||||
labelIds = [labelIds[0]]
|
||||
}
|
||||
setLabelIds(labelIds)
|
||||
setSearchField(prev => ({ ...prev, label_ids: labelIds.join(',') }))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user