✨ feat(提货列表): 新增提货列表|提货详情
This commit is contained in:
@@ -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])
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user