<template> <view class="zcvs"> <view class="zcvs-item"> <view>镜面转换</view> <view> <canvas canvas-id="cvs" id="cvs" style=" 400px; height: 400px;border: 1px solid #007AFF;" /> </view> </view> </view> </template> <script> export default { data() { return { }; }, onReady() { this.drawCvs(); }, methods: { drawCvs() { const ctx = uni.createCanvasContext('cvs'); ctx.setFillStyle("#007AFF"); ctx.translate(200, 200); ctx.scale(-1, 1); ctx.font = "bold 35px cursive"; ctx.setTextAlign("center"); ctx.fillText("青春纸盒子", 0, 0); ctx.draw(); }, } } </script> <style lang="scss" scoped> </style>