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: more specific mention of where PascalCase naming is allowed, in components/registration.md file. edited src/guide/components/registration.md file. More verbose for new learners. (#99) #100

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ export const sidebar: ThemeConfig['sidebar'] = {
link: '/guide/essentials/event-handling'
},
{ text: 'Form Input Bindings', link: '/guide/essentials/forms' },
{
text: 'Lifecycle Hooks',
link: '/guide/essentials/lifecycle'
},
{ text: 'Watchers', link: '/guide/essentials/watchers' },
{ text: 'Template Refs', link: '/guide/essentials/template-refs' },
{
text: 'Components Basics',
link: '/guide/essentials/component-basics'
},
{
text: 'Lifecycle Hooks',
link: '/guide/essentials/lifecycle'
}
]
},
Expand Down
8 changes: 4 additions & 4 deletions src/guide/built-ins/teleport.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

## Basic Usage {#basic-usage}

Sometimes we may run into the following scenario: a part of a component's template belongs to it logically, but from a visual standpoint, it should be displayed somewhere else in the DOM, outside of the Vue application.
Sometimes a part of a component's template belongs to it logically, but from a visual standpoint, it should be displayed somewhere else in the DOM, perhaps even outside of the Vue application.

The most common example of this is when building a full-screen modal. Ideally, we want the modal's button and the modal itself to live within the same component, since they are both related to the open / close state of the modal. But that means the modal will be rendered alongside the button, deeply nested in the application's DOM hierarchy. This can create some tricky issues when positioning the modal via CSS.
The most common example of this is when building a full-screen modal. Ideally, we want the code for the modal's button and the modal itself to be written within the same single-file component, since they are both related to the open / close state of the modal. But that means the modal will be rendered alongside the button, deeply nested in the application's DOM hierarchy. This can create some tricky issues when positioning the modal via CSS.

Consider the following HTML structure.

Expand Down Expand Up @@ -169,11 +169,11 @@ In some cases, we may want to conditionally disable `<Teleport>`. For example, w
</Teleport>
```

Where the `isMobile` state can be dynamically updated by detecting media query changes.
We could then dynamically update `isMobile`.

## Multiple Teleports on the Same Target {#multiple-teleports-on-the-same-target}

A common use case would be a reusable `<Modal>` component, with the potential for multiple instances to be active at the same time. For this kind of scenario, multiple `<Teleport>` components can mount their content to the same target element. The order will be a simple append - later mounts will be located after earlier ones within the target element.
A common use case would be a reusable `<Modal>` component, with the potential for multiple instances to be active at the same time. For this kind of scenario, multiple `<Teleport>` components can mount their content to the same target element. The order will be a simple append, with later mounts located after earlier ones, but all within the target element.

Given the following usage:

Expand Down
2 changes: 1 addition & 1 deletion src/guide/components/registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ Throughout the guide, we are using PascalCase names when registering components.

This is the recommended style when working with SFC or string templates. However, as discussed in [in-DOM Template Parsing Caveats](/guide/essentials/component-basics#in-dom-template-parsing-caveats), PascalCase tags are not usable in in-DOM templates.

Luckily, Vue supports resolving kebab-case tags to components registered using PascalCase. This means a component registered as `MyComponent` can be referenced in the template via both `<MyComponent>` and `<my-component>`. This allows us to use the same JavaScript component registration code regardless of template source.
Luckily, Vue supports resolving kebab-case tags to components registered using PascalCase. This means a component registered as `MyComponent` can be referenced inside a Vue template (or inside an HTML element rendered by Vue) via both `<MyComponent>` and `<my-component>`. This allows us to use the same JavaScript component registration code regardless of template source.
4 changes: 2 additions & 2 deletions src/guide/components/slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ function BaseLayout(slots) {

## Conditional Slots {#conditional-slots}

Sometimes you want to render something based on whether or not a slot is present.
Sometimes you want to render something based on whether or not content has been passed to a slot.

You can use the [$slots](/api/component-instance.html#slots) property in combination with a [v-if](/guide/essentials/conditional.html#v-if) to achieve this.

In the example below we define a Card component with three conditional slots: `header`, `footer` and the `default` one.
When the header / footer / default is present we want to wrap them to provide additional styling:
When content for the header / footer / default is present, we want to wrap it to provide additional styling:

```vue-html
<template>
Expand Down
2 changes: 1 addition & 1 deletion src/guide/essentials/reactivity-fundamentals.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ Due to these limitations, we recommend using `ref()` as the primary API for decl

### As Reactive Object Property \*\* {#ref-unwrapping-as-reactive-object-property}

A ref is automatically unwrapped when accessed or mutated as a property of a reactive object. In other words, it behaves like a normal property :
A ref is automatically unwrapped when accessed or mutated as a property of a reactive object. In other words, it behaves like a normal property:

```js
const count = ref(0)
Expand Down