Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to comment out a HTML tag in .Vue 's template

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?

like image 223
Ray Avatar asked Aug 09 '20 03:08

Ray


People also ask

How do I comment on Vue template?

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.

How do you put a comment in HTML?

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.

How do you comment multiple lines in HTML?

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.

What does template tag do in Vue?

Vue uses an HTML-based template syntax that allows you to declaratively bind the rendered DOM to the underlying component instance's data.


1 Answers

Like tony19 mentioned, installing the Vetur VSCode extension adds Vue language support, which correctly sets up comment toggling in Vue files.

like image 50
Spooky Avatar answered Oct 12 '22 07:10

Spooky