Page({ data: { camera: "../../assets/try/camera.png" }, // 拍照 takePhoto () { const ctx = wx.createCameraContext(); ctx.takePhoto({ quality: 'high', success: res => { // 旋转图片 var canvas = wx.createContext(); canvas.rotate(90 * Math.PI / 180); canvas.drawImage(res.tempImagePath); wx.drawCanvas({ canvasId: "canvas", success: res => this.see(res.tempImagePath) }) // this.see(res.tempImagePath) } }) }, error (e) { console.log(e.detail) }, // 预览 see (data) { wx.previewImage({ current: data, // 当前显示图片的http链接 urls: [data] // 需要预览的图片http链接列表 }) }, onLoad: function (options) { }, onReady: function () { }, onShow: function () { }, onHide: function () { }, onUnload: function () { }, onPullDownRefresh: function () { }, onReachBottom: function () { }, })