1、使用物料市场提供的封装好的组件
https://taro-ext.jd.com/plugin/view/5f648e4c0dd8313026e0942d
npm i echarts-taro3-react or yarn add echarts-taro3-react
2、使用、封装折线图组件:
lineChart.js
import React, { Component } from 'react'
import { View } from '@tarojs/components'
import { EChart } from 'echarts-taro3-react'
import PropTypes from 'prop-types'
import './index.less'
/**
|--------------------------------------------------
| #Component
| 折线图组件
|--------------------------------------------------
*/
class Line extends Component {
static defaultProps = {
xData: [],
yData: [],
}
componentDidMount() {
setTimeout(() => {
this.refresh()
}, 10)
// this.props.onRef(this)
}
refresh() {
const { xData, yData } = this.props
// 更多关于option的参数配置参考Echart