收藏
回答

wx.canvasToTempFilePath is not a function 报错?

onReady: function () {

var that = this

    //雷达图

    that.drawRadar()

  },

  // 雷达图

  drawRadar: function () {

    var that = this

    console.log(app.globalData.queryBean)


    var zx = app.globalData.queryBean.resultList[].eachItemScore.nameMatchingScore

    var zy = app.globalData.queryBean.resultList[].eachItemScore.specialNameScore

    var wg = app.globalData.queryBean.resultList[].eachItemScore.mathematicalGoodOrIllScore

    var yl = app.globalData.queryBean.resultList[].eachItemScore.syllableToneScore

    var wx = app.globalData.queryBean.resultList[].eachItemScore.luckyUseGodScore

    var sx = app.globalData.queryBean.resultList[].eachItemScore.chineseZodiacScore

    var sourceData1 = [

      [".", zx],

      [".", zy],

      [".", wg],

      [".", yl],

      [".", wx],

      [".", sx]

    ]

    // var sourceData2 = this.data.chanelArray2


    //调用

    that.drawEdge() //画六边形

    //this.drawArcEdge() //画圆

    that.drawLinePoint()

    //设置数据

    that.drawRegion(sourceData1, 'rgba(197, 76, 76, 0.637)') //第一个人的

    // this.drawRegion(sourceData2, 'rgba(255, 200, 0, 0.5)') //第二个人

    //设置文本数据

    that.drawTextCans(sourceData1)

    //设置节点

    that.drawCircle(sourceData1, 'rgba(197, 76, 76, 0.637)'

    // this.drawCircle(sourceData2, 'yellow')

    //开始绘制

    radCtx.draw(

     false, () => {

        wx.canvasToTempFilePath({

          // x: 0,

          // y: 0,

          // width: 670,

          // height: 959,

          // destWidth: 2010,

          // destHeight: 2877,

          canvasId: 'radarCanvas'

          success: function (res) {

            console.log(res.tempFilePath)

            var tempFilePath = res.tempFilePath;

            that.setData({

              imgfile: tempFilePath,

              canvashiden: true

            });

          },

          fail: function (res) {

            console.log(res);

          }

        });

      }

    )

  },




调用了  drawRadar()就会报错


回答关注问题邀请回答
收藏

1 个回答

  • 默
    2020-01-06

    什么错发些截图

    2020-01-06
    有用
    回复
登录 后发表内容
问题标签