🌈 style(eslint): add eslint rules

This commit is contained in:
xuan
2022-11-26 14:35:05 +08:00
parent f3aa20f049
commit 99a920975f
245 changed files with 14909 additions and 14349 deletions
+14 -13
View File
@@ -1,18 +1,18 @@
import { usePropsValue } from '@/use/useCommon'
import { View } from '@tarojs/components'
import classnames from 'classnames'
import React, { forwardRef, SetStateAction, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react'
import React, { SetStateAction, forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react'
import IconFont from '../iconfont/iconfont'
import styles from './index.module.scss'
import { usePropsValue } from '@/use/useCommon'
type CheckboxSize = 'normal' | 'small'
type params = {
onSelect?: () => void //选择触发
onClose?: () => void //取消触发
status?: boolean //是否选中
interface params {
onSelect?: () => void // 选择触发
onClose?: () => void // 取消触发
status?: boolean // 是否选中
hiddenCheckboxIcon?: boolean // 隐藏多选框
disabled?: boolean //是否禁用
disabled?: boolean // 是否禁用
triggerLabel?: boolean // 点击label是否触发选中
circle?: boolean
round?: boolean
@@ -40,7 +40,7 @@ export default forwardRef((props: params, ref) => {
} = props
const [selected, setSelected] = usePropsValue({
value: status,
defaultValue: false
defaultValue: false,
})
// const selectedRef = useRef(status)
// if (status !== undefined){
@@ -57,18 +57,19 @@ export default forwardRef((props: params, ref) => {
// }, [])
const onSelectEven = () => {
if (disabled) return false
let res = !selected
if (disabled) { return false }
const res = !selected
if (res) {
onSelect?.()
} else {
}
else {
onClose?.()
}
console.log('res', res)
setSelected(res)
}
const handleClickChildren = event => {
const handleClickChildren = (event) => {
if (!triggerLabel) {
return event.stopPropagation()
}
@@ -103,7 +104,7 @@ export default forwardRef((props: params, ref) => {
{!hiddenCheckboxIcon && (
<View className={classnames(styles.checkbox_main, getMainClassName())}>
<View className={classnames(styles.checkbox_item, getClassName())}>
{selected && <IconFont name='icon-a-jizhumima' size={22} color='#fff'></IconFont>}
{selected && <IconFont name="icon-a-jizhumima" size={22} color="#fff"></IconFont>}
</View>
</View>
)}