overtrue / vue-avatar-cropper

:girl: A simple and elegant avatar cropping and upload plugin.
https://github.com/overtrue/vue-avatar-cropper
506 stars 93 forks source link

this.$emit is not a function #7

Closed razukc closed 6 years ago

razukc commented 6 years ago

console script

overtrue commented 6 years ago

vue 正确引入了?

razukc commented 6 years ago

Well, the upload works fine; however, does not reach 'uploaded' method; here is my code: <user-image trigger="#set-avatar" :labels="{submit: 'Ok', cancel: 'Cancel'}" @uploaded="handleUploaded" @uploading="handleUploading" upload-form-name="profile_picture" upload-url="/control/public/api/postProfilePicture"> </user-image>

methods: { handleUploading(form, xhr) { form.append('remember_token', this.remember_token) var blob = form.get('profile_picture') var filename = blob.type.replace('/','.') form.set('profile_picture', blob, filename) }, handleUploaded(response, form, xhr){ console.log(response) }, }

razukc commented 6 years ago
  1. Can you provide a basic example using 'upload-handler'?

  2. Also, check this runkit: https://runkit.com/embed/ukwz76878ijx

overtrue commented 6 years ago

https://codesandbox.io/s/github/overtrue/vue-avatar-cropper-demo