import React from 'react'; import { Icon, Typography, Tooltip } from 'antd'; import styles from './index.less'; const firstUpperCase = (pathString: string) => { return pathString .replace('.', '') .split(/\/|\-/) .map(s => s.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase())) .filter(s => s) .join(''); }; const BlockCodeView: React.SFC<{ url: string; }> = ({ url }) => { console.log(url); const blockUrl = `umi block add https://github.com/ant-design/pro-blocks/tree/master/${firstUpperCase( url, )} --npm-client=cnpm --path=${url}`; return (

下载到项目中:

{blockUrl}
); }; export default ({ url }: { url: string }) => { return ( } trigger="click">
); };