Vue 2.5 Level E released: overview of new features, vuelevel

Source: Internet
Author: User

Vue 2.5 Level E released: overview of new features, vuelevel

We are very happy to announce the release of Vue 2.5 Level E! This release includes multiple feature enhancements. We recommend that you view the release instructions for complete details. In this article, we will focus on some important changes: Better TypeScript integration and better error handling, better support for functional components in a single file component and server rendering unrelated to the environment.

Better TypeScript Integration

Thanks to the help of the TypeScript team, 2.5 provides a type declaration that is greatly improved and can be used with out-of-the-box APIs of Vue without the component class decorator. The new type declaration also makes Vetur and Other Editors more powerful, providing better intelliisense support for pure JavaScript users. For more details, see our previous changes (translated version ).

Thanks to the PR initiated by Daniel Rosenwasser from the TypeScript team, as well as the improvements and reviews by core team members Herrington Darkholme and Katashin.

Note: TypeScript users should also update the following packages to the latest version to ensure compatibility with the type declaration: vue-router, vuex, vuex-router-sync, and vue-class-component.

Better error handling

In versions 2.4 and earlier, we usually use global config. errorHandleroption to handle unexpected errors in the application. We also have the renderError component option to handle errors in the rendering function. However, we lack a mechanism to handle generic errors in specific parts of the application.

In 2.5, we introduced a new errorCaptured hook. A component with this hook captures all errors in its child component tree (excluding its own) (excluding those called in asynchronous callback ). If you are familiar with React, this is similar to the concept of incorrect boundary introduced in React 16. The hook receives the same parameters as the global errorHandler. You can use this hook to handle and display errors elegantly.

Better support for function components in SFC

Use vue-loader> = 13.3.0 and Vue 2.5, in *. function components defined as single file components in the vue file can now get the correct template compilation, Scoped CSS and hot reload support. This makes it easier to convert leaf components into functional components for performance optimization.

* Thanks to the core team member blke Newman for his contributions to these features.

Server rendering unrelated to the environment

The default build of vue-server-renderer assumes a Node. js environment, which makes it unavailable in some JavaScript Runtime (such as php-v8js or Nashorn. In 2.5, we have released a vue-server-renderer version unrelated to the environment, which can be used in browsers or pure JavaScript Engines. This can enable interesting strategies, such as using Vue server rendering directly in the PHP process.

Similarly, we recommend that you view the complete release description to learn about the improvement of other APIs, including v-on, v-model, scoped slot, and provide/inject. You may also be interested in our public blueprint, detailing the team's work. Cheers!

Summary

The above is a small series of Vue 2.5 Level E introduced to you: a list of new features, hope to help you, if you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.