✨ feat(提货列表): 新增提货列表|提货详情

This commit is contained in:
xuan
2022-09-23 19:48:22 +08:00
parent 06c593e3d8
commit 0a3bdd83f3
21 changed files with 1187 additions and 31 deletions
+6 -2
View File
@@ -21,9 +21,13 @@ const segmentedControl: FC<PropsType> = (props) => {
})
const { list, defaultId = -1, onSelect } = props
const isValidNumber = (value: any) => {
return typeof value === 'number' && value >= 0
}
useEffect(() => {
console.log('defaultId', defaultId)
if (typeof defaultId === 'number' && defaultId >= 0) {
if (isValidNumber(defaultId)) {
console.log('defaultId:::', defaultId)
const index = list?.findIndex((item) => {
return item.id == defaultId
@@ -33,7 +37,7 @@ const segmentedControl: FC<PropsType> = (props) => {
setSelectInfo((e) => ({ ...e, tabId: list[num].id.toString() }))
}
}
setSelectInfo((e) => ({ ...e, selected: defaultId || -1 }))
setSelectInfo((e) => ({ ...e, selected: isValidNumber(defaultId) ? defaultId : -1 }))
console.log('selectInfo', selectInfo)
}, [defaultId])
+2 -4
View File
@@ -1,14 +1,12 @@
import { View } from '@tarojs/components'
import { FC, ReactNode } from 'react'
import IconFont from '../iconfont/iconfont'
import IconFont, { IconNames } from '../iconfont/iconfont'
import styles from './index.module.scss'
import classname from 'classnames'
type IconfontName = Parameters<typeof IconFont>['0']['name']
interface PropsType {
iconName: IconfontName
iconName: IconNames
title: string
children?: ReactNode
onClick?: Function