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.
Since TypeScript cannot handle type information for .vue
imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue
imports (for example to get props validation when using manual h(...)
calls), you can enable Volar's Take Over mode by following these steps:
- Run
Extensions: Show Built-in Extensions
from VSCode's command palette, look forTypeScript and JavaScript Language Features
, then right click and selectDisable (Workspace)
. By default, Take Over mode will enable itself if the default TypeScript extension is disabled. - Reload the VSCode window by running
Developer: Reload Window
from the command palette.
You can learn more about Take Over mode here.
- 代码架构
- public 公共数据
- src 源代码
- assets 静态文件
- components 组件
- App.vue 根组件
- env.d.ts ts 的声明文件
- main.ts 入口文件
- index.html 模版文件
- package.json 包管理的配置文件
- tsconfig.json ts 的配置文件
- vite 打包工具的配置文件
- yarn 文件的锁定文件
JavaScript 的超集解决 JavaScript 弱类型的弊端
App.vue 是根组件,相当于 html 中的 body
yarn add -D path
yarn add -d @types/node
- 通过 as 做类型断言
- js 传递参数,带一个大括号表示参数类型为一个对象
- yarn add -D @types/node
- yarn add -D @types/lodash
- Tailwind 官网安装
- 解决请求数据没有类型支持 安装 axios
- mock.js
- sass 插件,使用@apply 复用样式
- yarn add vee-validate@next @vee-validate/rules yup @vee-validate/i18n
- vim vscode 插件中平滑移动
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
- tailwindcss 插件实现 tailwindcss 补全
- tailwindcss 有一些组件库可以直接使用