From the template, rendering and template-ref parts of your Rendering, Watchers and Vue app, Directives notes.
v-if versus v-show: v-if mounts and unmounts (state lost, hooks run), works with v-else and <template>; v-show toggles display. v-show for frequent toggles.v-if with v-for: in Vue 3 v-if wins, so it can't see the loop variable; filter in a computed or use a wrapping <template>.push, pop, shift, unshift, splice, sort, reverse; filter, map, concat and slice return new arrays you assign.useTemplateRef() (3.5), filled after mount, null after unmount; for focus, measuring, scrolling and libraries. Child components expose methods with defineExpose."v-if removes from DOM, v-else only hides (display:none)": it's v-show that only hides. v-else is just the other branch of a v-if.
The note lists map() among the methods Vue reacts to. The tracked mutation methods are push, pop, shift, unshift, splice, sort and reverse; map returns a new array, like filter.
<Comp v-bind:obj> binds a single attribute named obj. To spread an object's properties as attributes or props, write v-bind="obj".
open() and close() with defineExpose, and open it from a parent through a template ref."Without a key Vue patches by position, so state that lives in the elements, like input text, focus or a child component's state, stays where it was while the data moves. A stable id lets Vue match elements to items and move them. The index is no better than no key, because removing one item shifts every index after it."
Nothing yet. Notes filed here show up on this page and the section overview.
Watchers and the lifecycle
watch versus watchEffect, deep watching and getters, race conditions with onWatcherCleanup, flush timing, the component lifecycle and what Vue cleans up, and what happens between a state change and the screen.
Component communication
Props, events, v-model, provide/inject, stores, slots, template refs and fallthrough attributes — when to use which, one-way data flow, defineModel with modifiers, scoped slots, and attributes with several root elements.