You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**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.**
341
341
342
342
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.
343
343
@@ -375,15 +375,15 @@ Unfortunately, HTML doesn't allow custom elements to be self-closing - only [off
375
375
376
376
## Component name casing in templates {#component-name-casing-in-templates}
377
377
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.**
379
379
380
380
PascalCase has a few advantages over kebab-case:
381
381
382
382
- Editors can autocomplete component names in templates, because PascalCase is also used in JavaScript.
383
383
-`<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).
384
384
- 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.
385
385
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.
387
387
388
388
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.**
389
389
@@ -401,7 +401,7 @@ Also note that if you've already invested heavily in kebab-case, consistency wit
401
401
```
402
402
403
403
```vue-html
404
-
<!-- In DOM templates -->
404
+
<!-- In in-DOM templates -->
405
405
<MyComponent></MyComponent>
406
406
```
407
407
@@ -416,7 +416,7 @@ Also note that if you've already invested heavily in kebab-case, consistency wit
0 commit comments