vue3+vite项目开发过程中的问题
模块 “path“只能在使用 “allowSyntheticDefaultImports“ 标志时进行默认导入,使用 “export =“ 声明的,只能使用 “allowSyntheticDefau“
在tsconfig.node.json中添加
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
component name ‘index’ should always be multi-word
eslintrc.js文件中
rules: {
'vue/multi-word-component-names': 0
}
nuxt3: WARN could not fetch remote https://github.com/nuxt/starter 21:37:11 WARN Make sure you have installed git correctly
多执行几遍命令就好了
ps: 执行完之后要用yarn install,因为npm install下载的包可能不完整,在run的时候会出错。
git push -u origin main出错
错误:
error: src refspec main does not match any
error: failed to push some refs to 'github.com:namephil/shop_manage.git'
解决:git push -u origin master
使用element-ui上传图片失败
原因:< el-upload>自己封装了ajax请求,没有使用到自己项目封装的axios
解决: 使用属性headers手动绑定一个请求头
代码
<template>
<el-upload
class="upload-demo"
action="http://127.0.0.1:8888/api/private/v1/upload"
:headers="headerObj">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</template>
<script>
// 已在sessionStorage中保存了token
data() {
headerObj: {
Authorization: window.sessionStorage.getItem('token')
}
}
</script>