vue问题总结

1.报错信息Already included file name 'c:/Users/lenovo/Desktop/vite-project/src/components/TodoList.vue' differs from file name 'c:/Users/lenovo/Desktop/vite-project/src/components/Todolist.vue' only in casing.
The file is in the program because:
Root file specified for compilation
Imported via "../components/TodoList.vue" from file 'c:/Users/lenovo/Desktop/vite-project/src/pages/home.vue'
Root file specified for compilation
1651197270(1).png

把vue后缀去掉就可以了

1651197317(1).png

2.解决系统兼容性中FormData对象包含appendData和realFormData属性

移动端vue项目前端通过axios发送post请求传输FormData数据上传文件到后台
发现pc和安卓系统正常使用new FormData()对象,但是IOS系统则产生的对象是Object{appendData : …, realFormData : …}这种格式的。
直接在index.html使用’< script>’ 标签解决:

或者

const formData = new FormData();
formData.append(key, value);
axios.post(`/api/yoururl`,
data:formData.realFormData || formData
)
.then(res=>{
  console.log('res=>',res);           
})

转载:https://blog.csdn.net/weixin_45178215/article/details/124060964

你可能感兴趣的:(vue问题总结)