增强antd输入框 加入增删标签功能

增强antd输入框 加入增删标签功能 安装

yarn add antd-input-tag or npm install antd-input-tag 在线例子

https://codesandbox.io/s/smoosh-cache-9zbfg?file=/src/App.js

支持键盘删除,enter自动分割(头条号搜索关键字)

快速使用

import React, { useRef, useCallback } from "react"; import AntdInputTag from "antd-input-tag"; export default function App() { const childRef = useRef(); const updateChildState = () => { // changeVal 子组件暴露方法 console.log(childRef.current.changeVal()); }; return ( <div className="App" style={{ paddingTop: "100px" }}> <AntdInputTag value={["aa", "bb", "cc", "dd"]} ref={childRef} /> <button onClick={updateChildState}>获取子组件数据</button> </div> ); } API

参数 说明 类型 默认值
value 传入数据 array []
ref ref ref -

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。