Solve the fuzzy preview of the WeChat applet echarts chart on the real machine

/获取像素比
      const getPixelRatio = () => {
        let pixelRatio = 0
        wx.getSystemInfo({
          success: function (res) {
            pixelRatio = res.pixelRatio
          },
          fail: function () {
            pixelRatio = 0
          }
        })
        return pixelRatio
      }
      // console.log(pixelRatio)
      var dpr = getPixelRatio()
        // 初始化图表
      const chart = echarts.init(canvas, null, {
        // renderer: 'svg',//微信小程序中不支持该设置
        width: width,
        height: height,
        devicePixelRatio: dpr
      });
      setOption(chart,this);

Guess you like

Origin blog.csdn.net/A_D_H_E_R_E/article/details/120108654