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 · all subjects

slots

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

named slot definition

A component can have multiple slots differentiated by name. Slots other than the default slot are referred to as named slots.

scoped slot definition

A scoped slot refers to a slot that receives props. In Vue 3, the slot APIs were simplified to make all slots behave like scoped slots. However, the use cases for scoped and non-scoped slots often differ, so the term still proves useful as a way to refer to slots with props.

scoped slot variable scope

The props passed to a slot can only be used within a specific region of the parent template responsible for defining the slot's contents. This region of the template behaves as a variable scope for the props, hence the name scoped slot.

slot definition

Slots are used to pass content to child components. Whereas props are used to pass data values, slots are used to pass richer content consisting of HTML elements and other Vue components.

defineSlots macro for type hints

defineSlots is only supported in Vue 3.3+. This macro provides type hints to IDEs for slot name and props type checking. It only accepts a type parameter (no runtime arguments). The type parameter should be a type literal where property keys are slot names and values are slot functions. The first argument of each function is the props the slot expects to receive.

defineSlots example with type parameter

const slots = defineSlots<{ default(props: { msg: string }): any }>(). This declares a default slot expecting props with a msg property. defineSlots returns the slots object equivalent to the slots exposed on setup context or useSlots().

Give your agent this brain