Recently, I'm start learning Vue and using Vue-Cli. There's a problem that I can not use hot-key(VSCode) to comment out a HTML tag in the . when I use "Ctrl+/" the line I want to comment out turns like this.
// <div> comment out this line</div>
not like this.
<!--<div> comment out this line</div>-->
Is there any possibility that I changed some setting in the VSCode to result this situation? Anyone know how to solve this problem?
To comment out code in HTML templates you can use HTML comment tag <--! Your comment --> . HTML comments will only be visible to the developer, they won't appear in the page source code.
The HTML Comment Tag Comments in HTML start with <! -- and end with --> . Don't forget the exclamation mark at the start of the tag! But you don't need to add it at the end.
You can comment multiple lines by the special beginning tag <! -- and ending tag --> placed before the first line and end of the last line as shown in the given example below.
Vue uses an HTML-based template syntax that allows you to declaratively bind the rendered DOM to the underlying component instance's data.
Like tony19 mentioned, installing the Vetur VSCode extension adds Vue language support, which correctly sets up comment toggling in Vue files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With