跳至主要內容
vue核心语法

Vue3核心语法

OptionsAPI 与 CompositionAPI

  • Vue2 是 OptionsAPI (选项式、配置式)风格
  • Vue3是CompositionAPI (组合式)风格

setup

  • setup是一个配置项,在script标签中 使用
  • setupthisundefined ,弱化了this
  • setup的执行时间在beforecreate() 之前

shenjianZ...大约 13 分钟vuecore
Vue3

创建App工程

相关信息

npm create vue@latest

## 1.创建命令
npm create vue@latest

## 2.具体配置
## 配置项目名称
√ Project name: vue3_test
## 是否添加TypeScript支持
√ Add TypeScript?  Yes
## 是否添加JSX支持
√ Add JSX Support?  No
## 是否添加路由环境
√ Add Vue Router for Single Page Application development?  No
## 是否添加pinia环境
√ Add Pinia for state management?  No
## 是否添加单元测试
√ Add Vitest for Unit Testing?  No
## 是否添加端到端测试方案
√ Add an End-to-End Testing Solution? » No
## 是否添加ESLint语法检查
√ Add ESLint for code quality?  Yes
## 是否添加Prettiert代码格式化
√ Add Prettier for code formatting?  No

shenjianZ...大约 1 分钟vuevueguide