6fedcom.github.io
6fedcom.github.io copied to clipboard
vscode 中 格式化 vue 如何不自动换行
js的自动格式化
getRootCatalogList()
.then(response => {
that.rootCatalogList = response.data;
that.catalogLoading = false;
console.log(
66,
"查询当前用户有权限的所有根目录列表",
response.data
);
})
.catch(err => {
console.log(err);
});
看的我尴尬癌都犯了,真心受不了,这开发不是哪抽疯了。 查了一下导致原因是:默认对JS使用了prettier. 解决办法是在VScode设置(setting.json)中,配置如下规则
"vetur.format.defaultFormatter": {
"html": "js-beautify-html",
"css": "prettier",
"postcss": "prettier",
"scss": "prettier",
"less": "prettier",
"js": "vscode-typescript",
"ts": "prettier",
"stylus": "stylus-supremacy"
}
这样格式化的时候就不会换行了
fetchRootCatalogList() {
const that = this;
getRootCatalogList().then(response = > {
that.rootCatalogList = response.data;
that.catalogLoading = false;
console.log(66, "查询当前用户有权限的所有根目录列表", response.data);
}).
catch (err = > {
console.log(err);
});
},
vetur.format.defaultFormatter
unknown configuration settinng 怎么破
没碰到这个报错,猜测可能是没有安装vetur的原因 @kid1412621
@ye63 装了, 我发现 eslint 和 prettier 有冲突
超级赞
不好用,在网上找的也不好使。。。
"vetur.format.defaultFormatter.js": "vscode-typescript",
vetur.format.defaultFormatter
unknown configuration settinng 怎么破
拆开来就好了,像这样:
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "vscode-typescript"
...