Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/mpvue-cropper/mpvue-cropper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
this._wecropper = new WeCropper(Object.assign(this.option, {
id: this._canvasId,
targetId: this._targetId,
pixelRatio: this._pixelRatio
pixelRatio: this._pixelRatio,
componentInstance: this,
}))
.on('ready', (...args) => {
this.$emit('ready', ...args)
Expand All @@ -98,11 +99,11 @@
})
}
},
onLoad () {
mounted () {
if (!this.option) {
return console.warn('[mpvue-cropper] 请传入option参数\n参数配置见文档:https://we-plugin.github.io/we-cropper/#/api')
}
this.init()
}
}
</script>
</script>
7 changes: 4 additions & 3 deletions src/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ export default function prepare () {
self.createCtx = () => {
const {
id,
targetId
targetId,
createCanvasContext
} = self

if (id) {
self.ctx = self.ctx || wx.createCanvasContext(id)
self.targetCtx = self.targetCtx || wx.createCanvasContext(targetId)
self.ctx = self.ctx || wx.createCanvasContext(id, createCanvasContext)
self.targetCtx = self.targetCtx || wx.createCanvasContext(targetId, createCanvasContext)

// 2d 没有这个方法
if (typeof self.ctx.setStrokeStyle !== 'function') {
Expand Down