Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remarks about minor versions #2990

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/api/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ Provide a value that can be injected in all descendant components within the app

## app.runWithContext() {#app-runwithcontext}

Execute a callback with the current app as injection context.

- Only supported in 3.3+

Execute a callback with the current app as injection context.

- **Type**

```ts
Expand Down
4 changes: 3 additions & 1 deletion src/api/built-in-special-attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ Used for binding [dynamic components](/guide/essentials/component-basics#dynamic

- **Expects:** `string | Component`

- **Usage on native elements** <sup class="vt-badge">3.1+</sup>
- **Usage on native elements**

- Only supported in 3.1+

When the `is` attribute is used on a native HTML element, it will be interpreted as a [Customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-customized-builtin-example), which is a native web platform feature.

Expand Down
4 changes: 2 additions & 2 deletions src/api/composition-api-dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ Injects a value provided by an ancestor component or the application (via `app.p

## hasInjectionContext() {#has-injection-context}

Returns true if [inject()](#inject) can be used without warning about being called in the wrong place (e.g. outside of `setup()`). This method is designed to be used by libraries that want to use `inject()` internally without triggering a warning to the end user.

- Only supported in 3.3+

Returns true if [inject()](#inject) can be used without warning about being called in the wrong place (e.g. outside of `setup()`). This method is designed to be used by libraries that want to use `inject()` internally without triggering a warning to the end user.

- **Type**

```ts
Expand Down
4 changes: 3 additions & 1 deletion src/api/options-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ Configure runtime compiler options for the component's template.

## slots<sup class="vt-badge ts"/> {#slots}

An option to assist with type inference when using slots programmatically in render functions. Only supported in 3.3+.
- Only supported in 3.3+

An option to assist with type inference when using slots programmatically in render functions.

- **Details**

Expand Down
4 changes: 2 additions & 2 deletions src/api/reactivity-utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ Can also be used to create a ref for a property on a source reactive object. The

## toValue() {#tovalue}

- Only supported in 3.3+

Normalizes values / refs / getters to values. This is similar to [unref()](#unref), except that it also normalizes getters. If the argument is a getter, it will be invoked and its return value will be returned.

This can be used in [Composables](/guide/reusability/composables.html) to normalize an argument that can be either a value, a ref, or a getter.

- Only supported in 3.3+

- **Type**

```ts
Expand Down
9 changes: 5 additions & 4 deletions src/api/sfc-script-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ defineExpose({

When a parent gets an instance of this component via template refs, the retrieved instance will be of the shape `{ a: number, b: number }` (refs are automatically unwrapped just like on normal instances).

## defineOptions() <sup class="vt-badge" data-text="3.3+" /> {#defineoptions}
## defineOptions() {#defineoptions}

- Only supported in 3.3+

This macro can be used to declare component options directly inside `<script setup>` without having to use a separate `<script>` block:

Expand All @@ -394,11 +396,12 @@ defineOptions({
</script>
```

- Only supported in 3.3+.
- This is a macro. The options will be hoisted to module scope and cannot access local variables in `<script setup>` that are not literal constants.

## defineSlots()<sup class="vt-badge ts"/> {#defineslots}

- Only supported in 3.3+

This macro can be used to provide type hints to IDEs for slot name and props type checking.

`defineSlots()` only accepts a type parameter and no runtime arguments. The type parameter should be a type literal where the property key is the slot name, and the value type is the slot function. The first argument of the function is the props the slot expects to receive, and its type will be used for slot props in the template. The return type is currently ignored and can be `any`, but we may leverage it for slot content checking in the future.
Expand All @@ -413,8 +416,6 @@ const slots = defineSlots<{
</script>
```

- Only supported in 3.3+.

## `useSlots()` & `useAttrs()` {#useslots-useattrs}

Usage of `slots` and `attrs` inside `<script setup>` should be relatively rare, since you can access them directly as `$slots` and `$attrs` in the template. In the rare case where you do need them, use the `useSlots` and `useAttrs` helpers respectively:
Expand Down
12 changes: 6 additions & 6 deletions src/api/utility-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ Used to annotate a prop with more advanced types when using runtime props declar

## MaybeRef\<T> {#mayberef}

Alias for `T | Ref<T>`. Useful for annotating arguments of [Composables](/guide/reusability/composables.html).
- Only supported in 3.3+

- Only supported in 3.3+.
Alias for `T | Ref<T>`. Useful for annotating arguments of [Composables](/guide/reusability/composables.html).

## MaybeRefOrGetter\<T> {#maybereforgetter}

Alias for `T | Ref<T> | (() => T)`. Useful for annotating arguments of [Composables](/guide/reusability/composables.html).
- Only supported in 3.3+

- Only supported in 3.3+.
Alias for `T | Ref<T> | (() => T)`. Useful for annotating arguments of [Composables](/guide/reusability/composables.html).

## ExtractPropTypes\<T> {#extractproptypes}

Expand Down Expand Up @@ -77,9 +77,9 @@ To extract public facing props, i.e. props that the parent is allowed to pass, u

## ExtractPublicPropTypes\<T> {#extractpublicproptypes}

Extract prop types from a runtime props options object. The extracted types are public facing - i.e. the props that the parent is allowed to pass.
- Only supported in 3.3+

- Only supported in 3.3+.
Extract prop types from a runtime props options object. The extracted types are public facing - i.e. the props that the parent is allowed to pass.

- **Example**

Expand Down