Artikelen over Vue

Artikelen over Vue

Vue

How to test Nuxt.js asyncData and fetch hooks

Nuxt's asyncData and fetch hooks need a different testing approach from ordinary Vue component methods. This article demonstrates calling hooks directly and supplying their context explicitly. It also draws the boundary around those tests: checking a hook's logic is useful, but it does not prove that Nuxt invokes it correctly during navigation or rendering.

Continue reading

Vue components vs directives

Components and directives both support reuse in Vue, but they solve different problems. Using a counter and a focus directive, this article shows when to package a piece of interface and when to attach behaviour directly to an element. It also explains the Vue 2 directive hooks and why clear responsibilities matter more than simply reusing code.

Continue reading

Vue components disappear in AEM

Vue components disappear in AEM

Editing a component in AEM can replace its HTML without restarting Vue, leaving the component invisible in the editor. This article walks through the integration problem and a custom refresh approach, including iframe handling, to keep Vue components working during authoring.

Continue reading

Communication between Vue components

How should Vue components share data without becoming tightly coupled? This article compares props and events, the Vue 2 .sync modifier and an event bus, alongside the pitfalls of reaching directly into parent or child instances. The aim is to make communication explicit while keeping components understandable and reusable.

Continue reading

Starten met unit testen in Vue

Frontendlogica in Vue kun je ook met unit tests controleren. Aan de hand van een klein component bouwen we een test op met Jasmine en Karma: het component laden, afzonderlijk gedrag herkennen en testgevallen kiezen. Daarbij kijken we naar verschillende invoerwaarden en grenzen, zodat de test meer doet dan alleen de code uitvoeren.

Lees verder