new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Vue · Tutorial · all subjects

components: mixins

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

mixins option type signature

The mixins option type is: interface ComponentOptions { mixins?: ComponentOptions[] }. It accepts an array of mixin objects containing instance options.

mixins merging and hook order

Mixin objects are merged into the component using option merging logic. Mixin hooks are called in the order they are provided, and called before the component's own hooks.

mixins example with created hook

Example showing mixins with hooks: const mixin = { created() { console.log(1) } }; createApp({ created() { console.log(2) }, mixins: [mixin] }); // => 1, then => 2

mixins not recommended in Vue 3

In Vue 2, mixins were the primary mechanism for code reuse. While mixins continue to be supported in Vue 3, composable functions using Composition API is now the preferred approach for code reuse between components.

Give your agent this brain