成品展示图:
直接上代码
//svg绘制漏斗
svgRender(
left,
index,
text,
topWidth,
height,
bottomWidth,
colorOne,
colorTwo,
isActive
) {
return (
<div
style={
{
position: 'relative',
width: { topWidth },
top: isActive ? this.state.translateY : 0,
}}
onClick={this.onsvg.bind(this, index)}
>
<svg height={height} className={styles['funnel-svg-box']}>
<path
fill={`url(#${index})`}
d={`M${left} 0 L${left + topWidth} 0 L${
left + topWidth - (topWidth - bottomWidth) / 2