您可能只是错过了useParams()钩子调用。 以下是如何将其实现到ProductList文件中: import React, { useEffect } from "react";import { useDispatch } from "react-redux";import { getProductBySlug } from "../../actions";import Layout from "../../Components/Layout/Layout";import { useParams } from 'react-router-dom'; // importing the hookconst ProductListPage = (props) => { const dispatch = useDispatch();let params = useParams(); // calling the hook useEffect(() => { console.log(props); dispatch(getProductBySlug(params.slug)); // you'll be able to use params object this way now (omitting the 'prop.match' prefix). }, [dispatc