第六章第10节的问题,求教
来源:6-10 个人设置页面上传头像功能实现

我是小谦谦呀
2018-11-15
手动添加了users数据表内avatar 字段,js中也做了判断的,,
var editor = new wangEditor('content');
if (editor.config) {
// 图片上传地址
editor.config.uploadImgUrl = '/posts/image/upload';
// 设置 headers
editor.config.uploadHeaders = {
'X-CSRF-TOKEN' : $('meta[name="csrf-token"]').attr('content')
};
editor.create();
}
$('.preview_input').change(function (event) {
var file = event.currentTarget.file[0];
var url = window.URL.createObjectURL(file);
$(event.target).next('.preview_img').attr('src', url);
});
依然报这个错误,怎么解决?
写回答
1回答
-
轩脉刃
2018-12-07
这个提示是说 editor.config 是null,要不你在editor.config.uploadImgUrl = '/posts/image/upload'; 之前console.log 打印出 editor.config 看看是啥
00
相似问题