Vue报错汇总

Target version not match, you can specify the target version in vueCompilerOptions.target in tsconfi

在jsconfig.json中加入

1
2
3
"vueCompilerOptions": {
"target": 2.7
}

整体如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"vueCompilerOptions": {
"target": 2.7
}
}

eslint报错 error Component name “xxx” should always be multi-word vue/multi-word-component-names

原因是规定了驼峰命名法

  1. 如果项目根目录没有eslintrc.js,创一个,填入下面内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// .eslintrc.js
module.exports = {
root: true,
env: {
node: true,
},
extends: [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript/recommended",
"plugin:prettier/recommended",
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {
"vue/multi-word-component-names": [
"error",
{
ignores: ["index"], //需要忽略的组件名
},
],
"vue/multi-word-component-names": "off"
},
};
  1. 在vue.config.js中加入

    1
    2
    3
    module.exports = {
    lintOnSave: false, // 当保存时不进行eslint的检查
    };

Uncaught TypeError: VueRouter is not a constructor

这个报错就是版本问题了,你需要的就是下载一个低版本的vue-router

1
npm i vue-router@3.5.2 -legacy-peer-deps

Module build failed , vue-router.esm.js in Vue js

这个报错重新启动一下程序就可以了,npm run serve

请求成功,但axios写的还是localhost:8087/Login ,写api还是不行()

跨域问题还是没有解决

image-20221028120850756

image-20221028121026652

image-20221028124300582

逆天啊,跨域问题居然是后面没有加/

image-20221028195209753

[babel-plugin-component] If you are using bothon-demand and importing all, make sure to invoke the i

这个项目重启一下就好了,可能是一次引入Element-ui太大的原因