mavonEditor icon indicating copy to clipboard operation
mavonEditor copied to clipboard

Problem with $img2Url

Open ghost opened this issue 5 years ago • 3 comments

Hi, I read many of issues and translate them. but i can't figure out what is problem of $img2Url function! Here is my code:

async $imgAdd(pos, $file) {
      const fd = new FormData()
      fd.append('photo', $file)
      fd.append('title', this.title)
      fd.append('categoryId', JSON.stringify(this.category))
      await this.$axios.post('post/photo', fd).then(response => {
        this.$refs.md.$img2Url(pos, response.data.photoInfo.url)
      })
    },

But i got this error:

vendors.app.js:2651 error TypeError: Cannot set property '0' of undefined
    at VueComponent.$changeUrl (vendors.app.js:23040)
    at VueComponent.$img2Url (vendors.app.js:23040)
    at index.1d58fe64d01b0adb4e15.hot-update.js:350

ghost avatar Jul 16 '19 13:07 ghost

pos begin with 1, so you can try this.$refs.md.$img2Url(pos + 1, response.data.photoInfo.url)

dodocoera avatar Nov 28 '19 08:11 dodocoera

I got same issue

pdt590 avatar Jan 25 '20 19:01 pdt590

I got same issue

monicaHsiao avatar Jan 06 '22 03:01 monicaHsiao