組件用withRouter包裹
獲取url里面的數(shù)字id 進行查詢
比如url是 localhost:3000/#/product/parts/265 輸出['265'] 可以拿這個id進行查詢
const { location } = this.props;
let pathSnippets = location.pathname.split('/').filter(i => i);
// 過濾數(shù)字類型
let componentId = pathSnippets.filter(i => {
return !isNaN(i);
});