搞定了,安装了react-konva就可以很容易在react插入很多canvas绘制的图形了; ——————————————————————————————————————————————————— import React, { Component, PropTypes } from 'react'import {Layer,Rect,Stage,Group,Circle,Arc} from 'react-konva'; class App extends React.Component { constructor(...args) { super(...args); this.state = { color: 'green' }; this.handleClick = this.handleClick.bind(this); } handleClick() { this.setState({ color: Konva.Util.getRandomColor() }); } render() { return ( <Stage width={700} height={700}> <Layer> <Arc x={100} y={100} innerRadius={0} outerRadius={100} strokeWidth={1} angle={360} rotationDeg={-90} fill={this.state.color} stroke={'black'} /> </Layer> </Stage> ); } } export default App
搞定了,安装了react-konva就可以很容易在react插入很多canvas绘制的图形了;
———————————————————————————————————————————————————
import React, { Component, PropTypes } from 'react'
import {Layer,Rect,Stage,Group,Circle,Arc} from 'react-konva';
class App extends React.Component {
}
export default App