微信小程序-prettier 格式化
一.安装prettier插件
二.配置开发者工具的设置
配置如下代码在setting.json里:
"editor.formatOnSave": true,"editor.defaultFormatter": "esbenp.prettier-vscode","prettier.documentSelectors": ["**/*.wxml", "**/*.wxss", "**/*.wxs"]
三.根目录创建.prettierrc文件
{"overrides": [{"files": "*.wxml","options": { "parser": "html" }},{"files": "*.wxss","options": { "parser": "css" }},{"files": "*.wxs","options": { "parser": "babel" }}]
}