Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$vm.$img2Url和$vm.$imglst2Url不生效 #37

Closed
vcxiaohan opened this issue Jul 29, 2017 · 2 comments
Closed

$vm.$img2Url和$vm.$imglst2Url不生效 #37

vcxiaohan opened this issue Jul 29, 2017 · 2 comments

Comments

@vcxiaohan
Copy link

<button @click="uploadimg">upload</button>
<mavon-editor ref="mavonEditor" v-model="formValidate.content" @imgAdd="$imgAdd" @imgDel="$imgDel" />
uploadimg($e){
    var formdata = new FormData();
    for(var _img in this.img_file){
        formdata.append('file', this.img_file[_img]);
    }
    axios({
        url: '/material/add',
        method: 'post',
        data: formdata,
        headers: { 'Content-Type': 'multipart/form-data' },
    }).then((res) => {
    	this.$refs.mavonEditor.$imgAddByUrl('./0', res.data.url)// 这个生效
    	this.$refs.mavonEditor.$img2Url('![图片](./0)', '![图片]('+ res.data.url +')')// 不生效
    	this.$refs.mavonEditor.$imglst2Url(['./0', res.data.url])// 不生效
        console.log(res);
    })
},

是不是我用的不对啊,我感觉![图片](./0)没有被改变成![图片](http://xxx)

@CHENXCHEN
Copy link
Collaborator

函数代码改为:

this.$refs.mavonEditor.$imglst2Url([['./0', res.data.url]])

@vcxiaohan
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants