Vue 3.0 has entered the release candidate stage!

Vue is undergoing a thorough review, and Vue 3.0 has entered the release candidate stage!

This has been going on for nearly two years, and finally, the implementation of the Vue 3 core API is now stable. There are many reasons for excitement.

Vue 3 has higher performance than Vue 2. Although it has been completely rewritten, the usage has not changed much, so there is no need to forget what you already know about Vue.

The Vue documentation has been completely migrated and revised. There are several new features (such as Composition API (inspired by React Hooks)) and help to reuse between multiple components.

Here is how to get Vue 3:

Use it on CodePen: https://codepen.io/team/Vue/pen/KKpRVp

Or use the script to connect: https://unpkg.com/vue@next

Start to create a project using Project Vite:

$ npm init vite-app <project-name>
$ cd <project-name>
$ npm install
$ npm run dev

vite in the development process is not packaged, ES source module directly transmitted to the browser, the browser uses its own <script module>analyzing supports, by each Import HTTP requests, the server intercepts the request and the development of code conversion to be converted. For example: the *.vuefile will be compiled before being sent back to the browser

This operation has many advantages:

After the development server is started, there is no need to perform packaging operations, and the startup will become very fast. The
code is compiled when needed, so the code is compiled only when it is actually displayed on the screen. When you start development, you no longer need to wait for the entire application to be compiled. This is a huge change for large applications
. The relationship between the performance of hot module replacement and the number of modules is decoupled, and hot module replacement becomes very fast.
Import local ES modules It may cause a deep import link, and the reload of the entire page will be slightly slower than relying on the packaged development server. However, this is a local development server, and the added time for this part should be very small compared to the actual compilation time (compiled files will be cached in memory)

The compilation of vite is essentially performed in Node.js. Technically speaking, it can support various code conversions supported by the packaging tool. There is nothing to prevent you from using the code package for production. In fact, vite provides vite build The script of is used for this operation, so you will not encounter the problem of network flow explosion in the production environment

Documentation update (now in Beta): https://v3.vuejs.org/guide/installation.html#release-notes, a migration guide to help you switch between versions, a new explanation of the auxiliary function part, in-depth understanding Composition API.

Guess you like

Origin blog.csdn.net/wu_xianqiang/article/details/107585770