mirror of
https://github.com/palxiao/poster-design
synced 2024-11-21 23:30:11 +00:00
fix: type problems
This commit is contained in:
parent
5f37f0e4b0
commit
2cdf950844
@ -96,7 +96,7 @@ type TGetCompListParam = {
|
||||
search?: string
|
||||
page?: number
|
||||
type?: number
|
||||
pageSize: number
|
||||
pageSize?: number
|
||||
cate?: number | string
|
||||
}
|
||||
|
||||
@ -109,6 +109,7 @@ export type TGetCompListResult = {
|
||||
title: string
|
||||
width: number
|
||||
name?: string
|
||||
cate?: string
|
||||
}
|
||||
|
||||
type getCompListReturn = TPageRequestResult<TGetCompListResult[]>
|
||||
|
@ -55,7 +55,7 @@ type TState = {
|
||||
list: TGetCompListResult[]
|
||||
searchValue: string
|
||||
currentCategory: TGetCompListResult | null
|
||||
types: []
|
||||
types: {cate: string, name: string}[]
|
||||
showList: TGetCompListResult[][]
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ const load = async (init: boolean = false) => {
|
||||
|
||||
const res = await api.home.getCompList({
|
||||
...pageOptions,
|
||||
cate: state.currentCategory?.id,
|
||||
cate: state.currentCategory?.id || state.currentCategory?.cate,
|
||||
})
|
||||
if (init) {
|
||||
state.list = res?.list
|
||||
|
@ -72,6 +72,7 @@ type TState = {
|
||||
|
||||
type TCurrentCategory = {
|
||||
name: string
|
||||
cate?: string | number
|
||||
id?: number
|
||||
}
|
||||
|
||||
@ -149,7 +150,7 @@ const load = async (init: boolean = false) => {
|
||||
state.loading = true
|
||||
pageOptions.page += 1
|
||||
const list = await api.material.getList({
|
||||
...{ cate: state.currentCategory?.id, search: state.searchKeyword, ...pageOptions },
|
||||
...{ cate: state.currentCategory?.id || state.currentCategory?.cate, search: state.searchKeyword, ...pageOptions },
|
||||
})
|
||||
if (init) {
|
||||
state.list = list?.list
|
||||
@ -168,6 +169,7 @@ const searchChange = (_: Event) => {
|
||||
}
|
||||
|
||||
const selectTypes = (item: TCurrentCategory) => {
|
||||
console.log(item)
|
||||
state.currentCategory = item
|
||||
load(true)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user