vite+vue3+ts创建的项目框架,包括基本的vue-router4、pinia、element-plus、sass、axios、svg图片等基础功能
|
|
3 년 전 | |
|---|---|---|
| .vscode | 3 년 전 | |
| public | 3 년 전 | |
| src | 3 년 전 | |
| .gitignore | 3 년 전 | |
| README.md | 3 년 전 | |
| index.html | 3 년 전 | |
| package-lock.json | 3 년 전 | |
| package.json | 3 년 전 | |
| tsconfig.json | 3 년 전 | |
| tsconfig.node.json | 3 년 전 | |
| vite.config.ts | 3 년 전 | |
| 记录.md | 3 년 전 |
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.
.vue Imports in TSTypeScript 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:
Extensions: Show Built-in Extensions from VSCode's command paletteTypeScript and JavaScript Language Features, right click and select Disable (Workspace)Developer: Reload Window from the command palette.npm create vite@latest vue-vite-ts -- --template vue-ts。npm i,启动服务npm run dev。vite.config.ts 中的配置,defineConfig.server新增配置。
> {npm install vue-router@4,使用HTML5模式。
在src路径下新建router文件夹,在main.ts中加载注册使用。npm install element-plus --save。
在main.ts中引用使用。
> import 'element-plus/dist/index.css'npm install pinia --save。
在main.ts中加载注册使用。
> import { createPinia } from 'pinia'npm install sass --save