# CanvasContext.clearRect(number x, number and number width, number height)
with Promise style call: Not supported
Mini Program plugin: Support
Clears the contents of the canvas inside the rectangular area
# parameter
# number x
The upper-left abscissa of a rectangular path
# number and
The ordinate of the upper-left corner of a rectangular path
# number width
Width of Rectangular Path
# number height
Height of rectangular path
# sample code
clearRect Instead of drawing a white rectangle in the address area, it empties it, for intuitive feel, yes canvas Added a layer of background color.
<canvas canvas-id="myCanvas" style="border: 1px solid background: #123456"/>
const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.fillRect(0, 0, 150, 200)
ctx.setFillStyle('blue')
ctx.fillRect(150, 0, 150, 200)
ctx.clearRect(10, 10, 150, 75)
ctx.draw()