0

我正在使用 react js,但我有一个问题选择选项没有打开。当我单击按钮时,它不起作用。我不明白是什么问题。我几乎检查了我能做的所有事情。这是代码

export default function Feature({ type }) {
    return (
        <div className="feature">
        {type && (
          <div className="category">
            <span>{type === "movie" ? "Movies" : "Series"}</span>    
            <select name="genre" id="genre">
              <option>Genre</option>
              <option value="adventure">Adventure</option>
              <option value="comedy">Comedy</option>
              <option value="crime">Crime</option>
              <option value="fantasy">Fantasy</option>
              <option value="historical">Historical</option>
              <option value="horror">Horror</option>
              <option value="romance">Romance</option>
              <option value="sci-fi">Sci-fi</option>
              <option value="thriller">Thriller</option>
              <option value="western">Western</option>
              <option value="animation">Animation</option>
              <option value="drama">Drama</option>
              <option value="documentary">Documentary</option>
            </select>
          </div>
        )}

这是我的家庭组件

import "./home.scss";
import Navbar from "../components/navbar/Navbar";
import Feature from "../components/featured/Feature"


export default function Home() {
    return (
        <div className="home">
           <Navbar />
           <Feature type="movie" />
           
          
        </div>
    )
}
4

1 回答 1

0

您的代码中可能没有关闭标签:

export default function Feature({ type }) {
    return (
        <div className="feature">
        {type && (
          <div className="category">
            <span>{type === "movie" ? "Movies" : "Series"}</span>    
            <select name="genre" id="genre">
              <option>Genre</option>
              <option value="adventure">Adventure</option>
              <option value="comedy">Comedy</option>
              <option value="crime">Crime</option>
              <option value="fantasy">Fantasy</option>
              <option value="historical">Historical</option>
              <option value="horror">Horror</option>
              <option value="romance">Romance</option>
              <option value="sci-fi">Sci-fi</option>
              <option value="thriller">Thriller</option>
              <option value="western">Western</option>
              <option value="animation">Animation</option>
              <option value="drama">Drama</option>
              <option value="documentary">Documentary</option>
            </select>
          </div>)}
          </div>)};

于 2021-12-01T17:53:22.307 回答