🌈 style(eslint): add eslint rules
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
import { RootPortal, View } from '@tarojs/components'
|
||||
import style from './index.module.scss'
|
||||
import classnames from 'classnames'
|
||||
import { memo, ReactNode, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import CloseBtnIcon from '@/components/closeBtn'
|
||||
import Taro from '@tarojs/taro'
|
||||
import classnames from 'classnames'
|
||||
import type { ReactNode } from 'react'
|
||||
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import style from './index.module.scss'
|
||||
import CloseBtnIcon from '@/components/closeBtn'
|
||||
|
||||
export interface PopupEvent {
|
||||
onClose?: () => void //关闭事件
|
||||
animationEnd?: () => void //弹出动画结束
|
||||
onClose?: () => void // 关闭事件
|
||||
animationEnd?: () => void // 弹出动画结束
|
||||
}
|
||||
|
||||
export interface Params extends PopupEvent {
|
||||
title?: string //标题
|
||||
show?: boolean //显示显示弹窗
|
||||
showTitle?: boolean //是否显示标题
|
||||
isFixed?: boolean //二次弹窗触发
|
||||
children?: ReactNode //插槽内容
|
||||
title?: string // 标题
|
||||
show?: boolean // 显示显示弹窗
|
||||
showTitle?: boolean // 是否显示标题
|
||||
isFixed?: boolean // 二次弹窗触发
|
||||
children?: ReactNode // 插槽内容
|
||||
// IconButton?: ReactNode, //
|
||||
showIconButton?: boolean //是否显示关闭按钮
|
||||
position?: 'bottom' | 'top' | 'right' //弹出位置
|
||||
showIconButton?: boolean // 是否显示关闭按钮
|
||||
position?: 'bottom' | 'top' | 'right' // 弹出位置
|
||||
customStyle?: React.CSSProperties
|
||||
overlayStyle?: React.CSSProperties
|
||||
safeAreaInsetBottom?: boolean // 是否为iphoneX提供小黑条适配
|
||||
@@ -47,7 +48,8 @@ export default memo(
|
||||
animationEnd?.()
|
||||
customStyle.overflow = 'unset'
|
||||
}, 260)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
clearTimeout(animationTime.current)
|
||||
}
|
||||
}, [show])
|
||||
@@ -60,20 +62,22 @@ export default memo(
|
||||
|
||||
return (
|
||||
<View className={style.drawer_main}>
|
||||
<View catchMove={true} className={classnames(style.drawer, show ? style.drawer_active : '')} style={customStyle}>
|
||||
<View catchMove className={classnames(style.drawer, show ? style.drawer_active : '')} style={customStyle}>
|
||||
{/* 遮罩层 start */}
|
||||
<View
|
||||
className={classnames(style.drawer_mask, { [style.drawer_mask_active]: show, [style['drawer_mask--hidden']]: !showOverLay })}
|
||||
onClick={onClose}
|
||||
style={overlayStyle}></View>
|
||||
style={overlayStyle}
|
||||
></View>
|
||||
{/* 遮罩层 end */}
|
||||
<View
|
||||
style={{ position: `${isFixed == true ? 'fixed' : 'absolute'}` }}
|
||||
className={classnames(style.drawer_container, style['drawer_container_' + position], {
|
||||
className={classnames(style.drawer_container, style[`drawer_container_${position}`], {
|
||||
[style.drawer_container_active]: show,
|
||||
[style[`drawer_container_${position}-withShadow`]]: !showOverLay,
|
||||
})}
|
||||
onClick={e => e.stopPropagation()}>
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
{showTitle && <View className={style.drawer_container_title}>{title}</View>}
|
||||
{showIconButton && (
|
||||
<View className={style.common_close_btn_icon}>
|
||||
@@ -81,10 +85,10 @@ export default memo(
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View id='drawerContainerContext' className={style.drawer_container_context}>
|
||||
<View id="drawerContainerContext" className={style.drawer_container_context}>
|
||||
{children}
|
||||
</View>
|
||||
{safeAreaInsetBottom && <View className='common_safe_area_y'></View>}
|
||||
{safeAreaInsetBottom && <View className="common_safe_area_y"></View>}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user