🌈 style(eslint): add eslint rules
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import Popup from '@/components/popup'
|
||||
import { useState, memo } from 'react'
|
||||
import { View } from '@tarojs/components'
|
||||
import styles from './index.module.scss'
|
||||
import AtCalendar from '@/components/calendar/index'
|
||||
import { memo, useState } from 'react'
|
||||
import dayjs from 'dayjs'
|
||||
import NormalButton from '../normalButton'
|
||||
import styles from './index.module.scss'
|
||||
import AtCalendar from '@/components/calendar/index'
|
||||
import Popup from '@/components/popup'
|
||||
|
||||
type DateArg = string | number | Date
|
||||
interface Props {
|
||||
@@ -14,14 +14,14 @@ interface Props {
|
||||
}
|
||||
|
||||
export default memo((props: Props) => {
|
||||
let { start = '', end = '', onSelectDate } = props
|
||||
const { start = '', end = '', onSelectDate } = props
|
||||
const [time, setTime] = useState<any>({})
|
||||
|
||||
const handTime = (e) => {
|
||||
const { start, end } = e.value
|
||||
// 如果选的是同一天的日期, end 自动加一天
|
||||
if (!end) {
|
||||
//判断如果没选下一天的时候
|
||||
// 判断如果没选下一天的时候
|
||||
e.value.end = `${dayjs(new Date(start)).add(1, 'day').format('YYYY-MM-DD')} 00:00:00`
|
||||
}
|
||||
if (start === end) {
|
||||
@@ -30,21 +30,20 @@ export default memo((props: Props) => {
|
||||
setTime(e)
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<View className={styles['time-box']}>
|
||||
<AtCalendar
|
||||
isMultiSelect
|
||||
format='YYYY-MM-DD 00:00:00'
|
||||
format="YYYY-MM-DD 00:00:00"
|
||||
currentDate={{
|
||||
start: start,
|
||||
end: end,
|
||||
start,
|
||||
end,
|
||||
}}
|
||||
onSelectDate={(e) => handTime?.(e)}
|
||||
onSelectDate={e => handTime?.(e)}
|
||||
/>
|
||||
</View>
|
||||
<NormalButton type='primary' onClick={() => onSelectDate?.(time)} size="normal" round customClassName={styles['sure-box']}>确认</NormalButton>
|
||||
<NormalButton type="primary" onClick={() => onSelectDate?.(time)} size="normal" round customClassName={styles['sure-box']}>确认</NormalButton>
|
||||
{/* <View className='sure-box' onClick={() => onSelectDate?.(time)}>
|
||||
确认
|
||||
</View> */}
|
||||
|
||||
Reference in New Issue
Block a user