1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| ready() { const query = wx.createSelectorQuery() query.select(`#${this.data.pageId}`).boundingClientRect() query.selectViewport().scrollOffset() query.exec((res) => { this.setData({ canvasHeight: res[0].height }) this.drowsyUserinfo() }) }
drowsyUserinfo() { let name_xx = app.globalData.userInfo.engName; let ctx = wx.createCanvasContext("myCanvas1", this); ctx.rotate(45 * Math.PI / 180);
for (let j = 1; j < this.data.canvasHeight/100; j++) { ctx.beginPath(); ctx.setFontSize(16); ctx.setFillStyle("rgba(169,169,169,.2)"); ctx.fillText(name_xx, 0, 100 * j);
for (let i = 1; i < this.data.canvasHeight/100; i++) { ctx.beginPath(); ctx.setFontSize(16); ctx.setFillStyle("rgba(169,169,169,.2)"); ctx.fillText(name_xx, 100 * i, 100 * j); } } for (let j = 0; j < this.data.canvasHeight/100; j++) { ctx.beginPath(); ctx.setFontSize(16); ctx.setFillStyle("rgba(169,169,169,.2)"); ctx.fillText(name_xx, 0, -100 * j);
for (let i = 1; i < this.data.canvasHeight/100; i++) { ctx.beginPath(); ctx.setFontSize(16); ctx.setFillStyle("rgba(169,169,169,.2)"); ctx.fillText(name_xx, 100 * i, -100 * j); } } ctx.draw() },
|