Skip to content

Commit

Permalink
fix(mpvue-cropper): lifecycle error
Browse files Browse the repository at this point in the history
  • Loading branch information
dlhandsome committed May 30, 2018
1 parent a9b7d54 commit f625af4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/mpvue-cropper/mpvue-cropper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@
src ? resolve(src) : reject()
})
})
}
},
mounted () {
_wecropper = new WeCropper(Object.assign(this.option, {
id: this._canvasId
}))
},
init () {
_wecropper = new WeCropper(Object.assign(this.option, {
id: this._canvasId
}))
.on('ready', (...args) => {
this.$emit('ready', ...args)
})
Expand All @@ -81,6 +80,13 @@
this.$emit('beforeDraw', ...args)
})
.updateCanvas()
}
},
onLoad () {
if (!this.option) {
return console.warn('[mpvue-cropper] 请传入option参数\n参数配置见文档:https://we-plugin.github.io/we-cropper/#/api')
}
this.init()
}
}
</script>

0 comments on commit f625af4

Please sign in to comment.