Uncaught (in promise) Error: Cannot get upload server address 没有配置上传地址
时间: 2024-05-22 15:13:17 浏览: 12
This error message is indicating that there is no upload server address configured. In order to resolve this issue, you will need to check your application configuration and ensure that the upload server address is properly set. This could involve updating your application code or settings to specify the correct address. If you are unsure of how to do this, you may need to consult your application documentation or seek assistance from a developer or IT professional.
相关问题
const editorConfig: Partial<IEditorConfig> = { // 在编辑器中,点击选中“附件”节点时,要弹出的菜单 hoverbarKeys: { attachment: { menuKeys: ['downloadAttachment'], // “下载附件”菜单 }, }, MENU_CONF: { // “上传附件”菜单的配置 uploadAttachment: { customUpload: true, // 开启自定义上传 onUpload(file: File) { // 调用自定义的上传方法 console.log(file); }, // 插入到编辑器后的回调 onInsertedAttachment(elem: any) { console.log('inserted attachment', elem); }, }, }, }; 配置完成后上传附件后报错 mf-dep____vendor.d64c5d34.js:111070 Uncaught (in promise) Error: Cannot get upload server address 没有配置上传地址
出现 "Cannot get upload server address" 错误,说明在上传附件时,编辑器找不到上传服务器的地址。因此,你需要在编辑器的配置文件中设置 `uploadImgServer` 字段,其值应该是你的上传服务器的地址。具体修改如下:
```
const editorConfig: Partial<IEditorConfig> = {
// 在编辑器中,点击选中“附件”节点时,要弹出的菜单
hoverbarKeys: {
attachment: {
menuKeys: ['downloadAttachment'], // “下载附件”菜单
},
},
// 设置上传服务器地址
uploadImgServer: 'http://your-upload-server.com/upload',
MENU_CONF: {
// “上传附件”菜单的配置
uploadAttachment: {
customUpload: true, // 开启自定义上传
onUpload(file: File) {
// 调用自定义的上传方法
console.log(file);
},
// 插入到编辑器后的回调
onInsertedAttachment(elem: any) {
console.log('inserted attachment', elem);
},
},
},
};
```
修改后,你的自定义上传方法应该可以正常使用了。如果还有问题,请仔细检查上传服务器的地址是否正确,并且上传接口是否能够正常响应。
Error: Uncaught (in promise): Error: NG04002
回答: 根据引用\[1\]和引用\[2\]的内容,你遇到的错误是因为在拦截器中的判断逻辑不正确导致的。在拦截器中,别人的判断是当response.data.status不等于1时,即认为请求失败,然后通过Promise.reject(rejection)来抛出错误。而你修改后的判断是当response.data.status等于200时,即认为请求成功,但实际上这个判断是错误的。所以你需要将判断逻辑修改为response.data.status !== 1,这样才能正确处理请求失败的情况。根据引用\[3\]的内容,"Error: Uncaught (in promise): Error: NG04002"是一个未被发现的错误,你之前可能认为是前端代码的问题,但经过排查后发现前端代码没有问题。因此,你需要仔细检查拦截器中的判断逻辑,确保正确处理请求的返回状态。
#### 引用[.reference_title]
- *1* *2* [Uncaught (in promise) 的解决方法,可能原因](https://blog.csdn.net/seimeii/article/details/127766422)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Uncaught (in promise) error问题排查](https://blog.csdn.net/GBS20200720/article/details/126435150)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)