Closed mannymu closed 4 years ago
Issue tracker 只用于反馈 bug 和 feature request。在提问前请仔细阅读我们的文档,并推荐阅读《提问的智慧》:https://github.com/ruby-china/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md
感谢建议,这里本身是支持在自定义组件中使用的,文档中没有注明。
可以在构造器参数中自定义设置 canvas 容器的上下文:
new WeCropper({ // ... other options // 用于拖拽缩放的画布上下文 ctx: wx.createCanvasContext(id, this), // 用于生成图片的画布上下文 targetCtx: wx.createCanvasContext(targetId, this) })
可以参考 miniprogram-cropper
源码里面的用法 https://github.com/we-plugin/we-cropper/blob/master/packages/miniprogram-cropper/src/index.js#L28
第二个参数,传入当前组件的 this , 方便在自定义组件中嵌套。 修改点:![image](https://user-images.githubusercontent.com/15630104/69321297-c6901c80-0c7d-11ea-9203-c604190a13a5.png)
创建 画布的时候使用:![image](https://user-images.githubusercontent.com/15630104/69321332-da3b8300-0c7d-11ea-85db-3dafc08230b8.png)