目录
二、Expected indentation of 2 spaces but found 4
三、error: ‘DsHeader‘ is defined but never used (no-unused-vars)报错的解决方案
一、vscode配置prettier
【场景说明】
【操作】在根目录创建.prettierrc文件。
{
"//": "https://prettier.io/docs/en/options.html#prose-wrap",
"_comment0": "trailingComma:在多行逗号分隔的句法结构中尽可能打印尾随逗号,默认es5,'es5'-在 ES5 中有效的尾随逗号(对象、数组等)。TypeScript 中的类型参数中没有尾随逗号。'none'- 没有尾随逗号。'all'- 尽可能使用尾随逗号",
"trailingComma": "none",
"_comment1": "printWidth:一行长度,默认80",
"printWidth": 120,
"_comment2": "tabWidth:缩进级别的空格数,默认2",
"tabWidth": 4,
"_comment3": "semi:在语句的末尾打印分号,默认true",
"semi": false,
"_comment4": "singleQuote:使用单引号而不是双引号,默认false",
"singleQuote": true,
"_comment5": "bracketSameLine:将>多行 HTML(HTML、JSX、Vue、Angular)元素放在最后一行
的末尾,而不是单独放在下一行,默认false",
"bracketSameLine": true,
"_comment6": "useTabs:使用制表符而不是空格缩进行,默认false",
"useTabs": false,
"_comment7": "quoteProps:引用对象中的属性时更改,默认'as-needed'",
"quoteProps": "as-needed",
"_comment8": "jsxSingleQuote:在 JSX 中使用单引号而不是双引号,默认false",
"jsxSingleQuote": true,
"_comment9": "bracketSpacing:在语句的末尾打印分号,默认true",
"bracketSpacing": true,
"_comment10": "arrowParens:引用对象中的属性时更改,默认'always','always'- 始终包括括
号。例子:(x) => x'avoid'- 尽可能省略括号。例子:x => x",
"arrowParens": "always",
"_comment11": "endOfLine:文本文件中的行尾风格,默认'lf','lf'– 仅换行 ( \n),常见于
Linux 和 macOS 以及 git repos 内部'crlf'- 回车 + 换行字符 ( \r\n),常见于 Windows",
"endOfLine": "lf"
}
二、Expected indentation of 2 spaces but found 4
【场景说明】
【操作】在根目录下找到.eslintrc.js,找到rules规则配置,直接加上:
{
indent: 0,
'space-before-function-paren': 0
}
三、error: ‘DsHeader‘ is defined but never used (no-unused-vars)报错的解决方案
【场景说明】
【操作】在根目录下找到.eslintrc.js,找到rules规则配置,直接加上:
{
indent: 0,
'space-before-function-paren': 0,
'no-unused-vars': 'off'
}
(前两行代码和上文中第二板块提到的添加的代码相同,无需重复添加,这里只用添加第三行代码即可)
四、其它操作
1.在终端下载模块包
npm i 或者 npm install
npm i element-ui -S
2.在main.js文件里的引用
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
3.在终端运行服务器
npm run serve