✨ feat:状态按钮重新对接完成进度20%

This commit is contained in:
Haiyi
2022-09-28 19:16:46 +08:00
parent 7362e5bca6
commit c3053f232a
20 changed files with 288 additions and 129 deletions
+7 -4
View File
@@ -1,7 +1,7 @@
import { View } from '@tarojs/components'
import style from './index.module.scss'
import classnames from 'classnames'
import { memo, ReactNode, useEffect, useMemo, useRef } from 'react'
import { memo, ReactNode, useEffect, useMemo, useRef, useState } from 'react'
import CloseBtnIcon from '@/components/closeBtn'
export interface Params {
@@ -13,10 +13,11 @@ export interface Params {
// IconButton?: ReactNode, //
showIconButton?: false | true //是否显示关闭按钮
position?: 'bottom' | 'top' | 'right' //弹出位置
animationEnd?: () => void //弹出动画结束
animationEnd?: () => void, //弹出动画结束
isFixed?: boolean //二次弹窗触发
}
export default memo(
({ title = '标题', show = false, showTitle = true, onClose, showIconButton = false, children, position = 'bottom', animationEnd }: Params) => {
({ title = '标题', show = false, showTitle = true, isFixed = false, onClose, showIconButton = false, children, position = 'bottom', animationEnd }: Params) => {
const animationTime = useRef<any>(null)
useEffect(() => {
if (show) {
@@ -30,16 +31,19 @@ export default memo(
useEffect(() => {
return () => {
clearTimeout(animationTime.current)
}
}, [])
const [ShowContext, setShowContext] = useState(false)
return (
<>
<View className={style.drawer_main}>
<View catchMove={true} className={`${style.drawer} ${show ? style.drawer_active : ''}`}>
<View className={classnames(style.drawer_mask, { [style.drawer_mask_active]: show })} onClick={() => onClose?.()}>
<View
style={{ position: `${isFixed == true ? 'fixed' : 'absolute'}`, }}
className={classnames(style.drawer_container, style['drawer_container_' + position], { [style.drawer_container_active]: show })}
onClick={(e) => e.stopPropagation()}>
{showTitle && <View className={style.drawer_container_title}>{title}</View>}
@@ -48,7 +52,6 @@ export default memo(
<CloseBtnIcon onClose={() => onClose?.()} />
</View>
)}
<View className={style.drawer_container_context}>{children}</View>
<View className='common_safe_area_y'></View>
</View>