Skip to content
Advertisement

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.

JavaScript

not like this.

JavaScript

Is there any possibility that I changed some setting in the VSCode to result this situation? Anyone know how to solve this problem?

Advertisement

Answer

For single line comment use Ctrl + /. This will do something like this

JavaScript

and for block comment use Ctrl + Shift + /. This will comment lines like this

JavaScript

or

JavaScript

In order to change shortcut key

  • Windows: File > Preferences > Keyboard Shortcuts.

  • MacOS: Code > Preferences > Keyboard Shortcuts.

and then search for comment like this Screenshot

Advertisement