Skip to content

Commit 7d96051

Browse files
authored
Merge branch 'vuejs:main' into main
2 parents 08fbd1a + a6fa35f commit 7d96051

File tree

23 files changed

+72
-40
lines changed

23 files changed

+72
-40
lines changed

.vitepress/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,16 @@ export default defineConfigWithTheme<ThemeConfig>({
646646
text: 'Português',
647647
repo: 'https://github.com/vuejs-translations/docs-pt'
648648
},
649+
{
650+
link: 'https://bn.vuejs.org',
651+
text: 'বাংলা',
652+
repo: 'https://github.com/vuejs-translations/docs-bn'
653+
},
654+
{
655+
link: 'https://it.vuejs.org',
656+
text: 'Italiano',
657+
repo: 'https://github.com/vuejs-translations/docs-it'
658+
},
649659
{
650660
link: '/translations/',
651661
text: 'Help Us Translate!',

src/api/built-in-special-attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Used for binding [dynamic components](/guide/essentials/component-basics#dynamic
9595

9696
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.
9797

98-
There is, however, a use case where you may need Vue to replace a native element with a Vue component, as explained in [DOM Template Parsing Caveats](/guide/essentials/component-basics#dom-template-parsing-caveats). You can prefix the value of the `is` attribute with `vue:` so that Vue will render the element as a Vue component instead:
98+
There is, however, a use case where you may need Vue to replace a native element with a Vue component, as explained in [in-DOM Template Parsing Caveats](/guide/essentials/component-basics#in-dom-template-parsing-caveats). You can prefix the value of the `is` attribute with `vue:` so that Vue will render the element as a Vue component instead:
9999

100100
```vue-html
101101
<table>

src/api/render-function.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ For manually resolving a registered component by name.
199199
<div class="composition-api">
200200

201201
```js
202-
const { h, resolveComponent } = Vue
202+
import { h, resolveComponent } from 'vue'
203203
204204
export default {
205205
setup() {
@@ -216,7 +216,7 @@ For manually resolving a registered component by name.
216216
<div class="options-api">
217217

218218
```js
219-
const { h, resolveComponent } = Vue
219+
import { h, resolveComponent } from 'vue'
220220
221221
export default {
222222
render() {

src/api/sfc-script-setup.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,4 +379,5 @@ defineProps<{
379379

380380
## Restrictions {#restrictions}
381381

382-
Due to the difference in module execution semantics, code inside `<script setup>` relies on the context of an SFC. When moved into external `.js` or `.ts` files, it may lead to confusion for both developers and tools. Therefore, **`<script setup>`** cannot be used with the `src` attribute.
382+
* Due to the difference in module execution semantics, code inside `<script setup>` relies on the context of an SFC. When moved into external `.js` or `.ts` files, it may lead to confusion for both developers and tools. Therefore, **`<script setup>`** cannot be used with the `src` attribute.
383+
* `<script setup>` does not support In-DOM Root Component Template.([Related Discussion](https://github.com/vuejs/core/issues/8391))

src/examples/ExampleRepl.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { Repl, ReplStore } from '@vue/repl'
33
import '@vue/repl/style.css'
44
import { data } from './examples.data'
5-
import { inject, watchEffect, version, Ref, onMounted, ref } from 'vue'
5+
import { inject, watchEffect, version, Ref, onMounted, ref, onUnmounted } from 'vue'
66
import {
77
resolveSFCExample,
88
resolveNoBuildExample,
@@ -49,6 +49,10 @@ onMounted(() => {
4949
}
5050
set()
5151
window.addEventListener('resize', set)
52+
53+
onUnmounted(() => {
54+
window.removeEventListener('resize', set)
55+
})
5256
})
5357
</script>
5458

src/glossary/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Typically, an in-DOM template starts off as HTML markup written directly in the
168168

169169
For more details see:
170170
- [Guide - Creating an Application - In-DOM Root Component Template](/guide/essentials/application.html#in-dom-root-component-template)
171-
- [Guide - Component Basics - DOM Template Parsing Caveats](/guide/essentials/component-basics.html#dom-template-parsing-caveats)
171+
- [Guide - Component Basics - in-DOM Template Parsing Caveats](/guide/essentials/component-basics.html#in-dom-template-parsing-caveats)
172172
- [Options: Rendering - template](/api/options-rendering.html#template)
173173

174174
## inject {#inject}

src/guide/built-ins/keep-alive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Now, the state will be persisted across component switches:
4747
</div>
4848

4949
:::tip
50-
When used in [DOM templates](/guide/essentials/component-basics#dom-template-parsing-caveats), it should be referenced as `<keep-alive>`.
50+
When used in [in-DOM templates](/guide/essentials/component-basics#in-dom-template-parsing-caveats), it should be referenced as `<keep-alive>`.
5151
:::
5252

5353
## Include / Exclude {#include-exclude}

src/guide/built-ins/transition-group.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import ListStagger from './transition-demos/ListStagger.vue'
2121
- CSS transition classes will be applied to individual elements in the list, **not** to the group / container itself.
2222

2323
:::tip
24-
When used in [DOM templates](/guide/essentials/component-basics#dom-template-parsing-caveats), it should be referenced as `<transition-group>`.
24+
When used in [in-DOM templates](/guide/essentials/component-basics#in-dom-template-parsing-caveats), it should be referenced as `<transition-group>`.
2525
:::
2626

2727
## Enter / Leave Transitions {#enter-leave-transitions}

src/guide/components/props.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export default {
148148
<span>{{ greetingMessage }}</span>
149149
```
150150

151-
Technically, you can also use camelCase when passing props to a child component (except in [DOM templates](/guide/essentials/component-basics#dom-template-parsing-caveats)). However, the convention is using kebab-case in all cases to align with HTML attributes:
151+
Technically, you can also use camelCase when passing props to a child component (except in [in-DOM templates](/guide/essentials/component-basics#in-dom-template-parsing-caveats)). However, the convention is using kebab-case in all cases to align with HTML attributes:
152152

153153
```vue-html
154154
<MyComponent greeting-message="hello" />

src/guide/components/registration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ Throughout the guide, we are using PascalCase names when registering components.
136136

137137
2. `<PascalCase />` makes it more obvious that this is a Vue component instead of a native HTML element in templates. It also differentiates Vue components from custom elements (web components).
138138

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

141141
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.

src/guide/components/v-model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ When used on a component, `v-model` instead expands to this:
2121

2222
```vue-html
2323
<CustomInput
24-
:modelValue="searchText"
25-
@update:modelValue="newValue => searchText = newValue"
24+
:model-value="searchText"
25+
@update:model-value="newValue => searchText = newValue"
2626
/>
2727
```
2828

src/guide/essentials/class-and-style.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,13 @@ data() {
9595
<div :class="classObject"></div>
9696
```
9797

98-
This will render the same result. We can also bind to a [computed property](./computed) that returns an object. This is a common and powerful pattern:
98+
This will render:
99+
100+
```vue-html
101+
<div class="active"></div>
102+
```
103+
104+
We can also bind to a [computed property](./computed) that returns an object. This is a common and powerful pattern:
99105

100106
<div class="composition-api">
101107

src/guide/essentials/component-basics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ If you are authoring your templates directly in a DOM (e.g. as the content of a
174174
<button-counter></button-counter>
175175
```
176176

177-
See [DOM template parsing caveats](#dom-template-parsing-caveats) for more details.
177+
See [in-DOM template parsing caveats](#in-dom-template-parsing-caveats) for more details.
178178

179179
## Passing Props {#passing-props}
180180

@@ -541,7 +541,7 @@ You can also use the `is` attribute to create regular HTML elements.
541541

542542
When switching between multiple components with `<component :is="...">`, a component will be unmounted when it is switched away from. We can force the inactive components to stay "alive" with the built-in [`<KeepAlive>` component](/guide/built-ins/keep-alive).
543543

544-
## DOM Template Parsing Caveats {#dom-template-parsing-caveats}
544+
## in-DOM Template Parsing Caveats {#in-dom-template-parsing-caveats}
545545

546546
If you are writing your Vue templates directly in the DOM, Vue will have to retrieve the template string from the DOM. This leads to some caveats due to browsers' native HTML parsing behavior.
547547

@@ -583,7 +583,7 @@ We have been using self-closing tags for components in previous code samples:
583583

584584
This is because Vue's template parser respects `/>` as an indication to end any tag, regardless of its type.
585585

586-
In DOM templates, however, we must always include explicit closing tags:
586+
In in-DOM templates, however, we must always include explicit closing tags:
587587

588588
```vue-html
589589
<my-component></my-component>
@@ -628,6 +628,6 @@ The custom component `<blog-post-row>` will be hoisted out as invalid content, c
628628
When used on native HTML elements, the value of `is` must be prefixed with `vue:` in order to be interpreted as a Vue component. This is required to avoid confusion with native [customized built-in elements](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-customized-builtin-example).
629629
:::
630630

631-
That's all you need to know about DOM template parsing caveats for now - and actually, the end of Vue's _Essentials_. Congratulations! There's still more to learn, but first, we recommend taking a break to play with Vue yourself - build something fun, or check out some of the [Examples](/examples/) if you haven't already.
631+
That's all you need to know about in-DOM template parsing caveats for now - and actually, the end of Vue's _Essentials_. Congratulations! There's still more to learn, but first, we recommend taking a break to play with Vue yourself - build something fun, or check out some of the [Examples](/examples/) if you haven't already.
632632

633633
Once you feel comfortable with the knowledge you've just digested, move on with the guide to learn more about components in depth.

src/guide/essentials/event-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ The `.capture`, `.once`, and `.passive` modifiers mirror the [options of the nat
270270
<div @scroll.passive="onScroll">...</div>
271271
```
272272

273-
The `.passive` modifier is typically used with touch event listeners for [improving performance on mobile devices](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners).
273+
The `.passive` modifier is typically used with touch event listeners for [improving performance on mobile devices](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scroll_performance_using_passive_listeners).
274274

275275
::: tip
276276
Do not use `.passive` and `.prevent` together, because `.passive` already indicates to the browser that you _do not_ intend to prevent the event's default behavior, and you will likely see a warning from the browser if you do so.

src/guide/essentials/forms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export default {
341341

342342
```vue-html
343343
<select v-model="selected">
344-
<option v-for="option in options" :key="option.value" :value="option.value">
344+
<option v-for="option in options" :value="option.value">
345345
{{ option.text }}
346346
</option>
347347
</select>

src/guide/reusability/composables.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,16 @@ export function useFetch(url) {
216216
const data = ref(null)
217217
const error = ref(null)
218218
219-
watchEffect(() => {
220-
// reset state before fetching..
221-
data.value = null
222-
error.value = null
223-
// toValue() unwraps potential refs or getters
224-
fetch(toValue(url))
219+
const fetchData = (dt) => {
220+
fetch(toValue(url))
225221
.then((res) => res.json())
226222
.then((json) => (data.value = json))
227223
.catch((err) => (error.value = err))
224+
}
225+
226+
watchEffect(() => {
227+
// reset state before fetching..
228+
fetchData(url)
228229
})
229230
230231
return { data, error }

src/guide/reusability/plugins.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ Plugins also allow us to use `inject` to provide a function or attribute to the
103103
// plugins/i18n.js
104104
export default {
105105
install: (app, options) => {
106-
app.config.globalProperties.$translate = (key) => {
107-
return key.split('.').reduce((o, i) => {
108-
if (o) return o[i]
109-
}, options)
110-
}
111-
112106
app.provide('i18n', options)
113107
}
114108
}

src/guide/typescript/composition-api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ onMounted(() => {
352352
</template>
353353
```
354354

355+
To get the right DOM interface you can check pages like [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#technical_summary).
356+
355357
Note that for strict type safety, it is necessary to use optional chaining or type guards when accessing `el.value`. This is because the initial ref value is `null` until the component is mounted, and it can also be set to `null` if the referenced element is unmounted by `v-if`.
356358

357359
## Typing Component Template Refs {#typing-component-template-refs}

src/partners/partners.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,25 @@
8686
{
8787
"name": "Curotec",
8888
"logo": "curotec.png",
89-
"intro": "Our clients leverage our deep Vue.js & Nuxt.js expertise to develop better digital products and quickly expand their product development team velocity.",
89+
"intro": "Work with a team that understands Vue.js inside and out. SaaS and enterprise teams leverage Curotec for best-in-class project execution and staff augmentation services focused on Vue.js.",
9090
"description": [
91-
"Curotec approaches software development and IT support differently – address the business problems that our clients tell us they need to have solved with technology and with the right resources at the right time. That starts with understanding your challenges and pairing it with solutions and talent to get the outcome you’re driving for.",
92-
"The result? Products that are responsive to your needs and primed for your growth, while ensuring your applications have a clean and straightforward end-user experience. And with well-developed and elegantly written code, it’s seamless for us to support and maintain as your needs evolve."
91+
"Whether you need a firm to build your idea, support an existing codebase, or augment your front-end dev team, we’ve got you covered. SaaS and enterprise product teams turn to Curotec for a firm that can get the job done right.",
92+
"We've got an all-shores model with team members in the US, LATAM, and South Asia. We'll create a flexible engagement for your needs aligned with your budget, timezone, and project goals. We also cover three main focus areas which include:",
93+
"- Enterprise software development",
94+
"- SaaS product development",
95+
"- Headless / Jamstack website development",
96+
"If you're looking for a Vue.js-focused front-end development team that writes great quality code and gets stuff done, click the contact button below and get in touch!"
9397
],
9498
"region": ["North America", "Latin America"],
95-
"proficiencies": ["Vue", "Nuxt", "Laravel", "Jamstack"],
99+
"proficiencies": [
100+
"Vue.js",
101+
"Nuxt",
102+
"Laravel",
103+
"Headless",
104+
"Node.js",
105+
"Python",
106+
"WordPress"
107+
],
96108
"website": {
97109
"text": "www.curotec.com",
98110
"url": "https://www.curotec.com/services/technologies/vuejs/"
40.1 KB
Loading
-2.35 KB
Loading

src/style-guide/rules-strongly-recommended.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ components/
337337

338338
## Self-closing components {#self-closing-components}
339339

340-
**Components with no content should be self-closing in [Single-File Components](/guide/scaling-up/sfc), string templates, and [JSX](/guide/extras/render-function#jsx-tsx) - but never in DOM templates.**
340+
**Components with no content should be self-closing in [Single-File Components](/guide/scaling-up/sfc), string templates, and [JSX](/guide/extras/render-function#jsx-tsx) - but never in in-DOM templates.**
341341

342342
Components that self-close communicate that they not only have no content, but are **meant** to have no content. It's the difference between a blank page in a book and one labeled "This page intentionally left blank." Your code is also cleaner without the unnecessary closing tag.
343343

@@ -375,15 +375,15 @@ Unfortunately, HTML doesn't allow custom elements to be self-closing - only [off
375375

376376
## Component name casing in templates {#component-name-casing-in-templates}
377377

378-
**In most projects, component names should always be PascalCase in [Single-File Components](/guide/scaling-up/sfc) and string templates - but kebab-case in DOM templates.**
378+
**In most projects, component names should always be PascalCase in [Single-File Components](/guide/scaling-up/sfc) and string templates - but kebab-case in in-DOM templates.**
379379

380380
PascalCase has a few advantages over kebab-case:
381381

382382
- Editors can autocomplete component names in templates, because PascalCase is also used in JavaScript.
383383
- `<MyComponent>` is more visually distinct from a single-word HTML element than `<my-component>`, because there are two character differences (the two capitals), rather than just one (a hyphen).
384384
- If you use any non-Vue custom elements in your templates, such as a web component, PascalCase ensures that your Vue components remain distinctly visible.
385385

386-
Unfortunately, due to HTML's case insensitivity, DOM templates must still use kebab-case.
386+
Unfortunately, due to HTML's case insensitivity, in-DOM templates must still use kebab-case.
387387

388388
Also note that if you've already invested heavily in kebab-case, consistency with HTML conventions and being able to use the same casing across all your projects may be more important than the advantages listed above. In those cases, **using kebab-case everywhere is also acceptable.**
389389

@@ -401,7 +401,7 @@ Also note that if you've already invested heavily in kebab-case, consistency wit
401401
```
402402

403403
```vue-html
404-
<!-- In DOM templates -->
404+
<!-- In in-DOM templates -->
405405
<MyComponent></MyComponent>
406406
```
407407

@@ -416,7 +416,7 @@ Also note that if you've already invested heavily in kebab-case, consistency wit
416416
```
417417

418418
```vue-html
419-
<!-- In DOM templates -->
419+
<!-- In in-DOM templates -->
420420
<my-component></my-component>
421421
```
422422

src/translations/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ aside: false
1313
- [Français / French](https://fr.vuejs.org) [[source](https://github.com/vuejs-translations/docs-fr)]
1414
- [한국어 / Korean](https://ko.vuejs.org) [[source](https://github.com/vuejs-translations/docs-ko)]
1515
- [Português / Portuguese](https://pt.vuejs.org) [[source](https://github.com/vuejs-translations/docs-pt)]
16+
- [বাংলা / Bengali](https://bn.vuejs.org) [[source](https://github.com/vuejs-translations/docs-bn)]
17+
- [Italiano / Italian](https://it.vuejs.org) [[source](https://github.com/vuejs-translations/docs-it)]
1618

1719
<!-- ## Work in Progress Languages {#work-in-progress-languages} -->
1820

0 commit comments

Comments
 (0)