First of all, the headline above is disgusting

How to generate posters to share circle of friends

The author of the development process above has been very clear, in the process of practice encountered a special pit problem: the generated temporary picture path, how to debug in real mode can not be displayed, what picture to base64, with several methods to base64 are not, then found a solution in the following blog

Reference: small program -canvasToTempFilePath author: iV5

Draw's callback function is asynchronous, with some appropriate time delay applied to calling the canvasToTempFilePath method

Wechat applet official explanation to canvasContext.draw

     CanvasContext.draw(false, () => {// After drawing, execute the callback function // pit wait for a while to get the correct image temporary pathsetTimeout(_ => {
            wx.canvasToTempFilePath()
        }, 500)
      })
Copy the code