🌈 style(eslint): add eslint rules
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { View } from '@tarojs/components'
|
||||
import styles from './index.module.scss'
|
||||
import CloseBtn from '@/components/closeBtn'
|
||||
import classnames from 'classnames'
|
||||
import { forwardRef, memo, ReactNode, useEffect, useImperativeHandle, useState } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
|
||||
import IconFont from '../iconfont/iconfont'
|
||||
import InputX from '../InputX/index'
|
||||
import styles from './index.module.scss'
|
||||
import CloseBtn from '@/components/closeBtn'
|
||||
|
||||
type Params = {
|
||||
interface Params {
|
||||
clickOnSearch?: (val: string) => void
|
||||
disabled?: boolean
|
||||
placeholder?: string
|
||||
@@ -20,9 +21,9 @@ type Params = {
|
||||
defaultValue?: string
|
||||
children?: ReactNode
|
||||
customRightSlot?: ReactNode
|
||||
adjustPosition?: boolean,
|
||||
adjustPosition?: boolean
|
||||
showScan?: boolean
|
||||
handScan?: () => void,
|
||||
handScan?: () => void
|
||||
cursorSpacing?: Number
|
||||
}
|
||||
|
||||
@@ -30,22 +31,22 @@ export default memo(
|
||||
forwardRef(
|
||||
(
|
||||
{
|
||||
clickOnSearch, //点击筛选按钮触发
|
||||
changeOnSearch, //输入文字触发
|
||||
clickOnSearch, // 点击筛选按钮触发
|
||||
changeOnSearch, // 输入文字触发
|
||||
adjustPosition = false,
|
||||
disabled = false, //是否禁用
|
||||
disabled = false, // 是否禁用
|
||||
placeholder = '输入搜索内容',
|
||||
showIcon = true, //是否显示关闭图标
|
||||
showBtn = false, //是否显示搜索按钮
|
||||
showIcon = true, // 是否显示关闭图标
|
||||
showBtn = false, // 是否显示搜索按钮
|
||||
btnStyle = {},
|
||||
placeIcon = 'inner', //搜索图标位置:inner在里面,out在外面
|
||||
btnTitle = '搜索', //搜索文字
|
||||
defaultValue = '', //默认值
|
||||
placeIcon = 'inner', // 搜索图标位置:inner在里面,out在外面
|
||||
btnTitle = '搜索', // 搜索文字
|
||||
defaultValue = '', // 默认值
|
||||
children,
|
||||
customRightSlot,
|
||||
showScan = false,
|
||||
handScan,
|
||||
cursorSpacing = 0
|
||||
cursorSpacing = 0,
|
||||
}: Params,
|
||||
ref,
|
||||
) => {
|
||||
@@ -54,7 +55,6 @@ export default memo(
|
||||
setInputCon(defaultValue)
|
||||
}, [defaultValue])
|
||||
|
||||
|
||||
const onInputEven = (e) => {
|
||||
const value = e.detail.value
|
||||
setInputCon(value)
|
||||
@@ -80,23 +80,24 @@ export default memo(
|
||||
<View className={styles.search_con}>
|
||||
{showIcon && (
|
||||
<IconFont
|
||||
name='icon-sousuo'
|
||||
name="icon-sousuo"
|
||||
size={37}
|
||||
color='#ababac'
|
||||
customClassName={classnames(styles.icon_a_sousuo1_self, placeIcon == 'inner' ? styles.icon_inner : styles.icon_out)}></IconFont>
|
||||
color="#ababac"
|
||||
customClassName={classnames(styles.icon_a_sousuo1_self, placeIcon == 'inner' ? styles.icon_inner : styles.icon_out)}
|
||||
></IconFont>
|
||||
)}
|
||||
<View className={styles.input_bar}>
|
||||
<InputX
|
||||
<InputX
|
||||
cursorSpacing={cursorSpacing as any}
|
||||
adjustPosition={adjustPosition}
|
||||
placeholderStyle='color:#ABABAB; font-size:26rpx'
|
||||
placeholderStyle="color:#ABABAB; font-size:26rpx"
|
||||
onConfirm={onSearch}
|
||||
disabled={disabled}
|
||||
value={inputCon}
|
||||
placeholder={placeholder}
|
||||
onInput={e => onInputEven(e)}
|
||||
customClassName={classnames(placeIcon == 'out' && styles.input_out)}
|
||||
customStyle={{width: '100%'}}
|
||||
customClassName={classnames(placeIcon == 'out' && styles.input_out)}
|
||||
customStyle={{ width: '100%' }}
|
||||
/>
|
||||
<View className={styles.search_closeBtn}>
|
||||
{!!inputCon && <CloseBtn onClose={() => clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />}
|
||||
@@ -105,8 +106,9 @@ export default memo(
|
||||
<View
|
||||
onClick={() => {
|
||||
handScan?.()
|
||||
}}>
|
||||
<IconFont name={'icon-saomiao'} size={40} color={'#337FFF'}></IconFont>
|
||||
}}
|
||||
>
|
||||
<IconFont name="icon-saomiao" size={40} color="#337FFF"></IconFont>
|
||||
</View>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user