0

当我打开一页时,我需要选择已经打开。我使用这个 tailwindcss 选择

我试过这个

<Listbox value={selectedPerson} onChange={setSelectedPerson}>
  //Listbox.Button has a prop called autoFocus
  <Listbox.Button autoFocus={true}>{selectedPerson.name}</Listbox.Button>
  <Listbox.Options>
    {people.map((person) => (
      <Listbox.Option
        key={person.id}
        value={person}
        disabled={person.unavailable}
      >
        {person.name}
      </Listbox.Option>
    ))}
  </Listbox.Options>
</Listbox>

道具“自动对焦”存在,但似乎不起作用。有什么建议吗?

4

0 回答 0