Monday, May 25, 2020

VUECONF US 2019 | Vue 3: What I'm Most Excited About with Chris Fritz





Below is a Youtube comment by: Prashanth Krishnamurthy 

Here's an outline of the video. Vue 3 - harder, better, faster, stronger.Trends - Simpler and more explicit. List of things that Chris Fritz is excited about: 1. Reactivity caveats are gone. You can do this now - arr[index] = newVal; 2. Multiple root nodes
3. Simpler transparent wrappers How do you write a custom component today for a 'super-powered' input box?
v-model="searchText" placeholder="Search" @keyup.enter="search" The actual component ..
{{ label }}
Compare this to a more concise component. {{ label }}

4. No more automatic attribute inheritance. Explicitly pass arguments using v-bind="$attrs" You don't have to use inheritAttrs: false (since it will never be true).

5. v-on will compile to attributes. E.g @keyup compiles to on-keyup. Just v-bind = "$attrs" ($attrs will incl. all non-emitted listeners) No more $listeners. No more .native modifier for v-on.

6. v-model will compile to attributes. Again, just v-bind = "$attrs". No more overriding the native input event. No more model option.

7. Smarter v-model on components If you want to move 'select' to a component. {{ choice }}

You will use -
The corresponding component code is simpler... {{ choice }}


8. Simpler render functions
render(h) { return h(BaseInput, { modelValue: this.searchText, onModelUpdate: newValue => { this.searchText=newValue; }, class: this.$style.searchInput, placeholder: 'Search' }) } Vue3 migration will be easier through automatic migrations (where the intent is clear).

No comments:

Post a Comment

Followers

Blog Archive