在vue项目的src目录下创建 .editorconfig配置文件
文件配置内容如下,按需调整
root = true
[*]
charset = utf-8
# 设置缩进风格(tab是硬缩进,space为软缩进)
indent_style = space
# 用一个整数定义的列数来设置缩进的宽度,如果indent_style为tab,则此属性默认为tab_width
indent_size = 4
# 设置换行符,值为lf、cr和crlf
end_of_line = lf
# 设为true表示使文件以一个空白行结尾
insert_final_newline = true
# 设为true表示会去除换行行首的任意空白字符。
trim_trailing_whitespace = true
在vscode中安装editorconfig插件
在vscode中安装editorconfig插件即可。