js文件改了,还是报错 Uncaught TypeError: Cannot set property 'uploadImgUrl' of undefined
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.files[0];
var url = window.URL.createObjectURL(file);
$(event.target).next(".preview_img").attr("src",url);
});
blade修改
<div class="form-group">
<label class="col-sm-2 control-label">头像</label>
<div class="col-sm-2">
<input class="file-loading preview_input" type="file" value="用户名" style="width:220px" name="avatar">
<img class="preview_img" src="{{$user->avatar}}" alt="" class="img-rounded" style="border-radius:500px;">
</div>
</div>
<button type="submit" class="btn btn-default">修改</button>
Laravel最新特性结合Mysql异步消息队列、ElasticSearch搜索引擎、Debugbar调试利器开发简书
了解课程