zoukankan      html  css  js  c++  java
  • react+antd+select+lodash模糊搜索防抖

    import { debounce } from 'lodash';
    

      

    <Form.Item label="前置任务" vvspan={24} labelCol={{ md: 3 }} wrapperCol={{ md: 21 }}>
                                {getFieldDecorator('frontTaskId', {
                                    initialValue: getPath(initInfo, 'frontTaskId', undefined)
                                })(
                                    <Select
                                        placeholder="请选择前置任务"
                                        allowClear
                                        showSearch
                                        onSearch={handleSearchFront}
                                        onChange={handleChangeFront}
                                        filterOption={false}
                                    >
                                        {frontList.map(item => (
                                            <Option key={item.taskId} value={item.taskId}>
                                                {item.taskName}
                                            </Option>
                                        ))}
                                    </Select>
                                )}
                            </Form.Item>
    

      

        // 前置任务列表搜索
        const handleSearchFront = debounce(value => {
            fetchFrontList(value);
        }, 200);
        // const handleSearchFront = value => {
        //     fetchFrontList(value);
        // };
        const handleChangeFront = debounce(value => {
            if (value === undefined) {
                fetchFrontList();
            }
        }, 200);
        // const handleChangeFront = value => {
        //     if (value === undefined) {
        //         fetchFrontList();
        //     }
        // };
    

      

  • 相关阅读:
    CodeForces
    CodeForces
    CodeForces 718C && HDU 3572 && Constellation
    CodeForces
    USACO 5.4 tour的dp解法
    10.22~10.28一周经典题目整理(meeting,BZOJ4377,POJ3659)
    codeforces 724D
    codeforces 724C
    hdu5909 Tree Cutting
    hdu5822 color
  • 原文地址:https://www.cnblogs.com/nangras/p/13306144.html
Copyright © 2011-2022 走看看