Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Vue.js 3 Design Patterns and Best Practices

You're reading from  Vue.js 3 Design Patterns and Best Practices

Product type Book
Published in May 2023
Publisher Packt
ISBN-13 9781803238074
Pages 296 pages
Edition 1st Edition
Languages
Author (1):
Pablo David Garaguso Pablo David Garaguso
Profile icon Pablo David Garaguso

Table of Contents (16) Chapters

Preface 1. Chapter 1: The Vue 3 Framework 2. Chapter 2: Software Design Principles and Patterns 3. Chapter 3: Setting Up a Working Project 4. Chapter 4: User Interface Composition with Components 5. Chapter 5: Single-Page Applications 6. Chapter 6: Progressive Web Applications 7. Chapter 7: Data Flow Management 8. Chapter 8: Multithreading with Web Workers 9. Chapter 9: Testing and Source Control 10. Chapter 10: Deploying Your Application 11. Chapter 11: Bonus Chapter - UX Patterns 12. Final words 13. Index 14. Other Books You May Enjoy Appendix: Migrating from Vue 2

Changes to v-model, props, and events

This is a big change from Vue 2 that can and will break your code. In Vue 3, we no longer receive and emit the property value. Instead, any prop can be input/output, such as v-model. The default v-model attribute is received in a prop named modelValue, and the counterpart emit prepends update:, so it is called update:modelValue.

In Vue 3, we can now have multiple v-models at the same time. For example, we can have v-model:person="person" in our component, and define the prop as "modelPerson" and the event as "update:modelPerson".

Props and emits are now macros (a macro is a special function provided by the bundler or framework). Props have the same footprint as in Vue 2, so you can define them as arrays, objects, include types, default values, and so on.

Here is an example with a default v-model and a notated model:

const $props=defineProps(['modelValue','modelPerson']),
$emit=defineEmits...
lock icon The rest of the chapter is locked
arrow left Previous Chapter
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}