hinesboy / mavonEditor

mavonEditor - A markdown editor based on Vue that supports a variety of personalized features
http://www.mavoneditor.com/
MIT License
6.38k stars 916 forks source link

vue3,md3.0.0-beta 上传图片回显问题 #765

Closed Cheng-x-c closed 1 year ago

Cheng-x-c commented 2 years ago
    console.log(url);
    // console.log(url)
    console.log(pos);
    console.log(mavonEditor);//到这里都没问题
    mavonEditor.methods.$img2Url(pos, url) 
  })

调用方法$img2Url报错: Cannot read properties of undefined (reading 'replace') at Object.$img2Url (mavon-editor.js:1) at Index.vue?import&t=1643357202381:524 跟踪过去: $img2Url: function $img2Url(fileIndex, url) { var reg_str = "/(!\[[^\[]?\](?=\())\(\s(" + fileIndex + ")\s*\)/g" , reg = eval(reg_str); this.d_value = this.d_value.replace(reg, "$1(" + url + ")"), // 这里报错, this.$refs.toolbar_left.$changeUrl(fileIndex, url), this.iRender() },