跳转后,url为:http://system/app/123454321
import React from 'react';
import { useLocation } from 'react-router-dom';
const foo: React.FC = () => {
const location = useLocation();
const pathname = location.pathname;
const infoId = pathname.substring(pathname.lastIndexOf('/') + 1);
return <div>{infoId}</div>
}
export default foo
以上方法,得到了infoId,就是123454321