hinesboy / mavonEditor

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

$img2Url报错 #298

Open LRY1994 opened 6 years ago

LRY1994 commented 6 years ago

vue.esm.js?efeb:591 [Vue warn]: Error in mounted hook: "TypeError: Cannot set property '2' of undefined"

found in

---> at src\components\WritePost.vue

at src\components\Post.vue at src\App.vue warn @ vue.esm.js?efeb:591 logError @ vue.esm.js?efeb:1737 globalHandleError @ vue.esm.js?efeb:1732 handleError @ vue.esm.js?efeb:1721 callHook @ vue.esm.js?efeb:2923 insert @ vue.esm.js?efeb:4158 invokeInsertHook @ vue.esm.js?efeb:5960 patch @ vue.esm.js?efeb:6179 Vue._update @ vue.esm.js?efeb:2670 updateComponent @ vue.esm.js?efeb:2788 get @ vue.esm.js?efeb:3142 run @ vue.esm.js?efeb:3219 flushSchedulerQueue @ vue.esm.js?efeb:2981 (anonymous) @ vue.esm.js?efeb:1837 flushCallbacks @ vue.esm.js?efeb:1758 vue.esm.js?efeb:1741 TypeError: Cannot set property '2' of undefined at VueComponent.$changeUrl (mavon-editor.js?392d:1) at VueComponent.$img2Url (mavon-editor.js?392d:1) at VueComponent.mounted (WritePost.vue?ab2a:94) at callHook (vue.esm.js?efeb:2921) at Object.insert (vue.esm.js?efeb:4158) at invokeInsertHook (vue.esm.js?efeb:5960) at VueComponent.patch [as __patch__] (vue.esm.js?efeb:6179) at VueComponent.Vue._update (vue.esm.js?efeb:2670) at VueComponent.updateComponent (vue.esm.js?efeb:2788) at Watcher.get (vue.esm.js?efeb:3142)

mounted() {
let imgList = this.postOld.imgList;//[["0", "test-promise-deferred.png"], ["1", "test-serTimeout.png"]]

        for (let  i=0;i<imgList.length;i++) {
            let img = imgList[i]
            this.$refs.mavon.$img2Url(img[0]-0, BASE_URL+img[1]);
        }

},
weicaker commented 6 years ago

image

mounted() {
    let imgList = [["0", "/upload/timg1535617753560.jpg"], ["1", "/upload/timg1535617753560.jpg"]]

        for (let  i=0;i<imgList.length;i++) {
            let img = imgList[i]
            this.$refs.md.$img2Url(img[0]-0, this.imgUrl+img[1]);
        }
  },

我这样写的,还是会报同样的错误,我哪里写的有问题呢?