github - 各位大爺給個starjavascript
demo - 展現效果vue
由於個人博客想要github的我的以及他人數據,因此研究了github v4 - graphql拿數據,而且已經佈置好了https://api.pipk.top/graphql 專用拿數據node接口,這部分工做已經作好。java
須要在react項目中使用,原生js或者vue我也去試過,應該差很少。node
import Github from '@pengliheng/github-report';
import '@pengliheng/github-report/lib/index.less';
const GithubReport = props => (
<div className="github-report">
<Github name="pengliheng" />
</div>
);
// router
<Route path="/githubReport/:name" component={GithubReport} />複製代碼
根據路由動態切換組件,將name做爲props傳入組件,組件內部根據name來動態顯示須要被2顯示的github用戶相關資料。react