我是 Reactjs 的初学者。我想创建一个自动完成组件,在每次输入更改时都会触发 API 并相应地更新选项。我正在使用 Material UI 提供的 Autocomplete 组件。据我了解,此处给出的示例会命中一个 API 并在本地对其进行过滤。我尝试使用材料组件提供的 InputChange 道具。我也发现了这个分析器 - /sf/answers/4182585921/。但想不出正确的方法。
import Autocomplete from "@material-ui/lab/Autocomplete";
import TextField from "@material-ui/core/TextField";
import {CircularProgress} from "@material-ui/core";
import debounce from 'lodash/debounce';
const SelectField = ({inputLabel}) => {
const [ open, setOpen ] = React.useState(false);
const [ options, setOptions ] = React.useState([]);
const [ inputValue, setInputValue ] = React.useState("");
const loading = open && options.length === 0;
const onInputChange = debounce((event, value) => {
console.log("OnInputChange",value);
setInputValue(value);
(async() …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用 Material UI Table组件。我想为 TableRow 组件提供边框样式。我正在使用 scss classNames 为组件提供样式。通常边框样式是在 TableCell 中处理的,但它不符合我的要求。有什么方法可以为 TableRow 提供边框样式吗?
TableRow API - https://material-ui.com/api/table-row/#css
我在这里做了一个 Codesandbox 实现