Commenting code is a simple but important part of writing clean, maintainable Vue.js components. Since a .vue file combines template, script, and style sections, each part has its own comment syntax.
Here’s a quick guide on how to add single-line and multi-line comments in all parts of a Vue single-file component (SFC).
Commenting in the Section
In the HTML-like part, use HTML comments:
Hello, Vue!
Note: Vue strips template comments when rendering to the DOM, they won’t appear in the final HTML.