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
把vue后綴去掉就可以了
2.解決系統(tǒng)兼容性中FormData對象包含appendData和realFormData屬性
移動端vue項目前端通過axios發(fā)送post請求傳輸FormData數(shù)據(jù)上傳文件到后臺
發(fā)現(xiàn)pc和安卓系統(tǒng)正常使用new FormData()對象溃睹,但是IOS系統(tǒng)則產(chǎn)生的對象是Object{appendData : …, realFormData : …}這種格式的。
直接在index.html使用’< script>’ 標(biāo)簽解決:
<script src="https://cdn.jsdelivr.net/npm/formdata-polyfill@3.0.20/formdata.min.js"></script>
或者
const formData = new FormData();
formData.append(key, value);
axios.post(`/api/yoururl`,
data:formData.realFormData || formData
)
.then(res=>{
console.log('res=>',res);
})
轉(zhuǎn)載:https://blog.csdn.net/weixin_45178215/article/details/124060964