1.原因:Ts语法报错了,当vue文件不符合ts语法规范时就会报错,在终端如下报错示范:
2.解决方案:
百度解决方案结果地址(自行选择打开阅读,下面我会提供步骤)
在ts配置文件中(文件名:tsconfig.json)选择整体代码替换为如下:
{
"compilerOptions": {
"target": "ES2016",
"module": "commonjs",
"lib": ["esnext", "dom"],
"allowJs": true,
"checkJs": false,
"jsx": "react",
"declaration": false,
"declarationMap": false,
"sourceMap": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"noEmit": true,
"isolatedModules": true,
"strict": false,
"noImplicitAny": false,
"strictNullChecks": false,
"strictFunctionTypes": false,
"strictBindCallApply": false,
"strictPropertyInitialization": false,
"noImplicitThis": false,
"alwaysStrict": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,
"baseUrl": "./",
"typeRoots": [
"./types/",
"./node_modules/@types"
],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
}
}
最后结束并重新运行即可解决。