如何插入一段漂亮的代码片
<canvas type="2d" id="myCycle"></canvas>
Page({
onLoad() {
const query2 = wx.createSelectorQuery()
query2.select('#myCycle').fields({ node: true, size: true }).exec(res => {
const canvas = res[0].node
const ctx = canvas.getContext('2d')
ctx.beginPath();
ctx.fillStyle = "#fff";
ctx.strokeStyle = "orange";
ctx.arc(150,70,50,0,2*Math.PI);
ctx.stroke();
ctx.fill();
ctx.closePath();
ctx.beginPath()
ctx.fillStyle = "orange";
ctx.arc(130,50,6,0,2*Math.PI);
ctx.stroke()
ctx.fill()
ctx.closePath()
ctx.beginPath()
ctx.fillStyle = "orange";
ctx.arc(170,50,6,0,2*Math.PI);
ctx.stroke()
ctx.fill()
ctx.closePath()
ctx.beginPath()
ctx.fillStyle = "black";
ctx.arc(170,50,2,0,2*Math.PI);
ctx.stroke()
ctx.fill()
ctx.closePath()
ctx.beginPath()
ctx.fillStyle = "black";
ctx.arc(130,50,2,0,2*Math.PI);
ctx.stroke()
ctx.fill()
ctx.closePath()
ctx.beginPath();
ctx.arc(150,70,30,0,1*Math.PI);
ctx.strokeStyle='orange';
ctx.stroke();
ctx.closePath();
})
}
})