Vue 3 performance tập trung vào giảm unnecessary reactivity và re-renders qua directives, component patterns, và build tooling.
v-memocho long lists với expensive rendersshallowRef/shallowReactivecho large data structures không cần deep reactivity- Lazy load routes và components với dynamic import
<KeepAlive>cho frequently toggled components- Dùng
computedthaymethodsđể cache kết quả - Tránh unnecessary watchers — prefer computed
v-oncecho content không thay đổi- Tránh inline handlers phức tạp trong template
- Tree-shaking — import chỉ những gì cần từ Vue
- Analyze bundle với
rollup-plugin-visualizer
v-memofor long lists with expensive rendersshallowRef/shallowReactivefor large data structures without need for deep reactivity- Lazy-load routes and components with dynamic import
<KeepAlive>for frequently toggled components- Use
computedinstead ofmethodsto cache results - Avoid unnecessary watchers — prefer computed
v-oncefor content that never changes- Avoid complex inline handlers in templates
- Tree-shaking — import only what you need from Vue
- Analyze bundles with
rollup-plugin-visualizer