feat: 修改首页分类

This commit is contained in:
秋水浮尘
2023-11-23 01:46:50 +08:00
parent 4ff59f5eda
commit 2f330b22cb
10 changed files with 383 additions and 74 deletions

View File

@@ -0,0 +1,38 @@
import { useState } from 'react'
import LabelList from './label-list'
import PrimaryList from './primary-list'
const CategoryList = props => {
const [selectValue, setSelectValue] = useState({
primaryId: '', // 大类ID
categoryId: '', // 二级分类ID,
labelId: '' // 标签ID
})
const changePrimaryId = primaryId => {
setSelectValue({
...selectValue,
primaryId
})
}
const changeLabel = ids => {
const [categoryId, labelId] = ids.split('_')
const values = {
...selectValue,
categoryId,
labelId
}
setSelectValue({ ...values })
props.onChangeLabel({ ...values })
}
return (
<div className='category-list-container'>
<PrimaryList changePrimaryId={changePrimaryId} />
<LabelList primaryId={selectValue.primaryId} changeLabel={changeLabel} />
</div>
)
}
export default CategoryList