Vue.js 2.6: New syntax

Vue.js 2.6 is here and brings some new features. Part of this already points towards Vue.js 3, which should come in summer: The new syntax for scoped slots has been implemented. In addition, Vue is now five years old!

The new minor version Vue.js 2.6 has released some new features for the JavaScript framework. The Vue team follows the principle of semantic versioning – Breaking Changes is highlighted for Vue.js 3, which is expected to be released in the summer of this year. Nevertheless, one of the new features of Vue.js 2.6 already in the direction of Vue 3: scoped slots have got a new syntax. The new syntax combines normal and scoped slots under v-slots , as Evan You explains in the blog post about the release . As an example, you can enter the following code:

<
my-component
>
  
<
template
v-slot:header>
    
<
p
>Header</
p
>
  
</
template
>
  
  
<
template
v-slot:item
=
"{ data }"
>
    
<
h2
>{{ data.title }}</
h2
>
    
<
p
>{{ data.text }}</
p
>
  
</
template
>
  
  
<
template
v-slot:footer>
    
<
p
>Footer</
p
>
  
</
template
>
</
my-component
>

Further information on the new features of slots can also be found in the RFC text . Through the RFC, the new syntax for slots, which will be fully implemented with Vue.js 3, was agreed with the community in January. Also, the two bug fix releases already released for Vue 2.6 have once again changed the slot syntax. Starting with Vue 2.6.2, normal slots that work with the new v-slots still have access to this.$slots . Overall, both types of slots from Vue.js 3 should be treated equally. This not only affects the new syntax but, as a result, the compiling behavior as well as the performance to be improved.

Vue.js 2.6 & Vue.js 3: News for the framework

Among other things, Vue.js 2.6 introduces error handling for asynchronous operations in lifecycle hooks and event handlers. For this purpose, the integrated error handler from Vue has got a function with which errors in v-on -Handlers are detected. Also new in Vue 2.6 is an ES Module Build, which can be used directly in the browser.

Vue.js 3, the upcoming major version of Vue.js, is due to be released this summer. Along the way, several new features can be discussed within the scope of RFCs , so that the community can co-decide on the details of the implementation. There is a separate repository on GitHub for the RFCs.

Vue.js 2.6 is named Macross. More information about the release can be found in the blog post for the release and the release notes.

LEAVE A REPLY

Please enter your comment!
Please enter your name here