最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

React?程序設(shè)計(jì)簡單的輕量級自動(dòng)完成搜索框應(yīng)用

 更新時(shí)間:2022年10月25日 15:22:10   作者:Jovie  
這篇文章主要為大家介紹了React?程序設(shè)計(jì)簡單的輕量級自動(dòng)完成搜索框應(yīng)用,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

實(shí)現(xiàn)效果

一個(gè)為React應(yīng)用程序設(shè)計(jì)的簡單的輕量級自動(dòng)完成搜索框。

如何使用它

1.安裝并導(dǎo)入該組件

# Yarn
$ yarn add react-search-box
# NPM
$ npm i react-search-box
import React, { Component } from "react";
import ReactSearchBox from "react-search-box";

2.將ReactSearchBox 組件添加到應(yīng)用程序中

<ReactSearchBox
  placeholder="Type Something..."
  value="ReactScript"
  data={this.data}
  callback={(record) => console.log(record)}
/>

3.定義你的自動(dòng)建議列表的數(shù)據(jù)

export default class App extends Component {
  data = [
    {
      key: "react",
      value: "React Native",
    },
    {
      key: "vue",
      value: "Vue Component",
    },
    // ...
  ];
  render() {
    return (
      <ReactSearchBox
        placeholder="Type Something..."
        value="ReactScript"
        data={this.data}
        callback={(record) => console.log(record)}
      />
    );
  }
}

4.所有可用的組件道具

/*
 * The placeholder text for the input box.
 */
placeholder: string;
/*
 * The name attribute for the input box.
 */
name?: string;
/*
 * An array of objects which acts as the source of data for the dropdown. This prop is required.
 */
data: { key: string; value: string }[];
/*
 * Configs to override default Fuse configs.
 */
fuseConfigs?: {};
/*
 * Focus on the input box once the component is mounted.
 */
autoFocus?: boolean;
/*
 * A function which acts as a callback when any record is selected. It is triggered once a dropdown item is clicked.
 */
onSelect: (record: Record) => void;
/*
 * A function which acts as a callback when the input is focussed.
 */
onFocus?: () => void;
/*
 * A function which acts as a callback when the input value is changed.
 */
onChange: (value: string) => void;
/*
 * Color of the text in the input box.
 */
inputFontColor?: string;
/*
 * Color of the border of the input box.
 */
inputBorderColor?: string;
/*
 * Size of the font of the input box.
 */
inputFontSize?: string;
/*
 * Height of the input box.
 */
inputHeight?: string;
/*
 * Background color of the input box.
 */
inputBackgroundColor?: string;
/*
 * Background color on hover of the dropdown list items.
 */
dropdownHoverColor?: string;
/*
 * Border color of the dropdown.
 */
dropdownBorderColor?: string;
/*
 * Clear the input value when any record is selected.
 */
clearOnSelect?: boolean;
/*
 * Icon to be rendered on the left of the input box.
 */
leftIcon?: ReactNode;
/*
 * The size of the icon (based on the leftIcon prop).
 */
iconBoxSize?: number | string;
/*
 * The type of the input.
 */
type?: string;

預(yù)覽

The postAutocomplete Search Box For Reactappeared first onReactScript.

以上就是React 程序設(shè)計(jì)簡單的輕量級自動(dòng)完成搜索框應(yīng)用的詳細(xì)內(nèi)容,更多關(guān)于React 輕量級自動(dòng)搜索框的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • react批量引入svg圖標(biāo)的方法

    react批量引入svg圖標(biāo)的方法

    這篇文章主要介紹了react批量引入svg圖標(biāo)的方法,在批量引入之前,我們需要安裝一個(gè)包并配置到typescript.json文件中,需要的朋友可以參考下
    2024-03-03
  • react動(dòng)態(tài)路由的實(shí)現(xiàn)示例

    react動(dòng)態(tài)路由的實(shí)現(xiàn)示例

    React中動(dòng)態(tài)路由通過ReactRouter庫實(shí)現(xiàn),根據(jù)應(yīng)用狀態(tài)或用戶交互動(dòng)態(tài)顯示或隱藏組件,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-11-11
  • React Antd中如何設(shè)置表單只輸入數(shù)字

    React Antd中如何設(shè)置表單只輸入數(shù)字

    這篇文章主要介紹了React Antd中如何設(shè)置表單只輸入數(shù)字問題,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-06-06
  • React類組件中super()和super(props)的區(qū)別詳解

    React類組件中super()和super(props)的區(qū)別詳解

    這篇文章給大家詳細(xì)介紹了React類組件中super()和super(props)有什么區(qū)別,文中通過代碼示例給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下
    2024-01-01
  • react hooks實(shí)現(xiàn)原理解析

    react hooks實(shí)現(xiàn)原理解析

    這篇文章主要介紹了react hooks實(shí)現(xiàn)原理,文中給大家介紹了useState dispatch 函數(shù)如何與其使用的 Function Component 進(jìn)行綁定,節(jié)后實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下
    2022-10-10
  • React競態(tài)條件Race Condition實(shí)例詳解

    React競態(tài)條件Race Condition實(shí)例詳解

    這篇文章主要為大家介紹了React競態(tài)條件Race Condition實(shí)例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-11-11
  • ReactJs快速入門教程(精華版)

    ReactJs快速入門教程(精華版)

    React 起源于 Facebook 的內(nèi)部項(xiàng)目,因?yàn)樵摴緦κ袌錾纤?JavaScript MVC 框架,都不滿意,就決定自己寫一套,用來架設(shè) Instagram 的網(wǎng)站.這篇文章主要介紹了ReactJs快速入門教程(精華版)的相關(guān)資料,需要的朋友可以參考下
    2016-11-11
  • React?SSR架構(gòu)Stream?Rendering與Suspense?for?Data?Fetching

    React?SSR架構(gòu)Stream?Rendering與Suspense?for?Data?Fetching

    這篇文章主要為大家介紹了React?SSR架構(gòu)Stream?Rendering與Suspense?for?Data?Fetching解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-03-03
  • TS裝飾器bindThis優(yōu)雅實(shí)現(xiàn)React類組件中this綁定

    TS裝飾器bindThis優(yōu)雅實(shí)現(xiàn)React類組件中this綁定

    這篇文章主要為大家介紹了TS裝飾器bindThis優(yōu)雅實(shí)現(xiàn)React類組件中this綁定,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-11-11
  • React從插槽、路由、redux的詳細(xì)過程

    React從插槽、路由、redux的詳細(xì)過程

    React需要自己開發(fā)支持插槽功能,原理:父組件組件中寫入的HTML,可以傳入子組件的props中,這篇文章主要介紹了React從插槽、路由、redux的詳細(xì)過程,需要的朋友可以參考下
    2022-10-10

最新評論

靖边县| 北流市| 尚义县| 边坝县| 洛川县| 乐平市| 依兰县| 平安县| 普兰县| 米泉市| 宽甸| 绵竹市| 沁源县| 江阴市| 闽侯县| 永新县| 荣成市| 乌恰县| 平陆县| 宜川县| 甘南县| 松桃| 大宁县| 克东县| 秦安县| 牟定县| 卢湾区| 盐池县| 顺昌县| 积石山| 周宁县| 五家渠市| 新竹市| 桐乡市| 卓资县| 措勤县| 汾阳市| 浦东新区| 富源县| 共和县| 石家庄市|