Bug以及各种奇奇怪怪的问题记录

记录贴

Posted by Heber on April 28, 2018

说明

本文章用于记录一些在各种情况下遇到的Bug以及各种问题,以免忘记。本文章为汇总文章,将长期不固定更新。

使用echarts-for-weixin时,无法动态改变图表样式,发现一段代码,可能可以借鉴

import * as echarts from '../../components/ec-canvas/echarts'
import option from './index-option.js'
const initChart = (option) =>{
  return (canvas, width, height) => {
    const chart = echarts.init(canvas, null, {
      width: width,
      height: height
    });
    canvas.setChart(chart)
    chart.setOption(option)
    return chart
  }
}
Page({
  /**
   * 页面的初始数据
   */
  data: {
    ecOne: {
      onInit: initChart(option.pie)
    },
    ecTwo: {
      onInit: initChart(option.pie)
    }
  }
})