getApp(); Page({ data: { imgSrc: "", scale: 1, src: "", width: 250, height: 250 }, onLoad: function (e) { console.log(e.imgSrc) wx.setNavigationBarTitle({ title: "图片裁剪" }); this.cropper = this.selectComponent("#image-cropper"); this.setData({ src: e.imgSrc, scale:e.scale }); wx.showLoading({ title: "加载中" }); }, cropperload: function (e) { console.log("cropper初始化完成"); }, loadimage: function (e) { console.log("图片加载完成", e.detail); wx.hideLoading(); this.cropper.imgReset(); }, clickcut: function (e) { console.log(e.detail); var t = getCurrentPages(); (t.length >= 2 ? t[t.length - 2] : void 0).setData({ imgTempSrc: e.detail.url }), wx.navigateBack({}); }, cropperDone: function (e) { var t = e.detail, o = t.src, a = (t.cropperData, getCurrentPages()); (a.length >= 2 ? a[a.length - 2] : void 0).setData({ imgTempSrc: o }); }, cropperCancel: function () { wx.navigateBack({}); }, doCropperDone: function (e) { var t = getCurrentPages(); (t.length >= 2 ? t[t.length - 2] : void 0).setData({ imgTempSrc: e }), wx.navigateBack({}); }, cropperFail: function (e) { e.detail; console.log(e), wx.showToast({ title: "裁剪失败,请重试", icon: "none", success: function () { wx.navigateBack({}); } }); } });