This template should help get you started developing with Vue 3 in Vite.
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
TypeScript cannot handle type information for .vue
imports by default, so we replace the tsc
CLI with vue-tsc
for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue
types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps: 参考: https://blog.csdn.net/qq_63354840/article/details/127545605
npm init vue@latest
Eslint Yes
Perttier NO
安装 vite-plugin-eslint eslint 不通过 vite 报错插件
执行 yarn lint 修复
设置 .vscode 保存修复eslint格式
- 修改 package.json
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0",
"stylelint-scss": "^3.21.0",
- 添加 styleLinttrc.js 配置
- 设置.vscode/setting.json
- 安装低版本 syltelint 插件 v0.87.6
- 之后 就实现了 css 保存是自动格式化
- 设置 viewport 在 index.html 中:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
2.安装插件
npm install amfe-flexible -S
npm install postcss-pxtorem -D
- 配置文件
const postCssPxToRem = require("postcss-pxtorem")
css: {
postcss: {
plugins: [
postCssPxToRem({
rootValue: 75, // 1rem的大小
propList: ['*'], // 需要转换的属性,这里选择全部都进行转换
})
]
},
}
- 导入 在 main.js 中引入 amfe-flexible 插件:
import 'amfe-flexible'
- 测试 设置宽度 750px 就是整个宽度 因为 rootValue: 75
yarn add axiox
二次封装 utils/request.js