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

上传图片功能怎么配置? #7

Closed
zongcong opened this issue Jul 6, 2018 · 13 comments
Closed

上传图片功能怎么配置? #7

zongcong opened this issue Jul 6, 2018 · 13 comments

Comments

@zongcong
Copy link

zongcong commented Jul 6, 2018

上传图片功能怎么配置?使用不了报错

@ghost
Copy link

ghost commented Jul 6, 2018

上传文件需要后端提供接口,你给组件的config属性传递一个对象就可以,里面的serverUrl字段填上后端给你的接口地址。如果你是还有疑问或者配置错误,可以把我写的DEMO克隆下来,作为参考。
image

image

@zongcong
Copy link
Author

zongcong commented Jul 9, 2018

谢谢,还有一个问题,就是循环多个编辑器的时候,接口请求返回数据如果比多个编辑快的时候,会报错,这个怎么解决呢

@ghost
Copy link

ghost commented Jul 9, 2018

@zongcong 可以把你的代码和报错截个图吗?

@zongcong
Copy link
Author

zongcong commented Jul 9, 2018

image
这是报错,然后有时候页面的双向绑定没有起作用,我估计是编辑器比接口请求的数据晚加载了

@zongcong
Copy link
Author

zongcong commented Jul 9, 2018

我测试了一下在接口请求的数据成功那边加了个定时器之后,等编辑器加载完成之后在重新赋值是正常的

@ghost
Copy link

ghost commented Jul 9, 2018

你尝试一下在@ready方法中请求接口

@ghost
Copy link

ghost commented Jul 9, 2018

@zongcong 不要设定时器,接口返回的时间和实例化编辑器的时间是不确定的

@zongcong
Copy link
Author

zongcong commented Jul 9, 2018

我这边是要在接口返回的数据加载相应的或者多个的编辑器。这样好像行不通吧

@ghost
Copy link

ghost commented Jul 9, 2018

我理解你得意思是:你要绑定的数据是接口请求下来的,但是多个编辑器实例化的速度比你接口返回数据慢,所以报错了。但是即使你一开始就绑定值,也不会报错呀!所以不太明白你的为什么会报错,可以给我看一下你具体使用的代码吗?

@zongcong
Copy link
Author

zongcong commented Jul 9, 2018

image
image
第一张是正常能够绑定的时候,第二张是绑定不了的时候。报错我这边检查一下

@ghost
Copy link

ghost commented Jul 9, 2018

我看你第二张图里面的实例是空,v-model绑定的数据有内容,但是我在组件封装的时候已经考虑到了
image
当你没有实例的时候,会先初始化实例,初始化之后才会把值赋给ueditor,所以不太清楚你为什么报错,如果你不方便贴你项目代码的图,可以发到我邮箱hc199421@gmail.com

@zongcong
Copy link
Author

zongcong commented Jul 9, 2018

找到问题了,我这边的问题,谢谢了

@ghost ghost closed this as completed Jul 9, 2018
@KDWangBoss
Copy link

大佬,可以问下这个富文本编辑器图片上传serverUrl是指后端的上传接口吗

This issue was closed.
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