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