mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-03 19:38:20 +08:00
初始化3.0.0版本
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Input, IconFont } from 'knowdesign';
|
||||
import './style/index.less';
|
||||
|
||||
interface IObjectProps {
|
||||
[propName: string]: any;
|
||||
}
|
||||
interface ISearchInputProps {
|
||||
onSearch: (value?: string) => unknown;
|
||||
iconType?: string;
|
||||
attrs?: IObjectProps;
|
||||
}
|
||||
|
||||
const SearchInput: React.FC<ISearchInputProps> = (props: ISearchInputProps) => {
|
||||
const { onSearch, iconType = 'icon-fangdajing', attrs } = props;
|
||||
const [changeVal, setChangeVal] = useState<string>('');
|
||||
|
||||
const onChange = (e: any) => {
|
||||
if (e.target.value === '' || e.target.value === null || e.target.value === undefined) {
|
||||
onSearch('');
|
||||
}
|
||||
attrs?.onChange && attrs?.onChange(e.target.value);
|
||||
setChangeVal(e.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<Input.Search
|
||||
{...attrs}
|
||||
suffix={<IconFont type={iconType} onClick={() => onSearch(changeVal)} />}
|
||||
onChange={onChange}
|
||||
className={'dcloud-clustom-input-serach ' + `${attrs?.className}`}
|
||||
onSearch={(val: string) => {
|
||||
onSearch(val);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default SearchInput;
|
||||
@@ -0,0 +1,11 @@
|
||||
.dcloud-clustom-input-serach{
|
||||
|
||||
.dcloud-input-affix-wrapper{
|
||||
border-radius: 2px !important;
|
||||
}
|
||||
|
||||
.dcloud-input-group-addon{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user