admin管理员组

文章数量:1287253

Recently, I'm start learning Vue and using Vue-Cli. There's a problem that I can not use hot-key(VSCode) to ment out a HTML tag in the . when I use "Ctrl+/" the line I want to ment out turns like this.

// <div> ment out this line</div>

not like this.

<!--<div> ment 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?

Recently, I'm start learning Vue and using Vue-Cli. There's a problem that I can not use hot-key(VSCode) to ment out a HTML tag in the . when I use "Ctrl+/" the line I want to ment out turns like this.

// <div> ment out this line</div>

not like this.

<!--<div> ment 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?

Share Improve this question asked Aug 9, 2020 at 3:18 RayRay 3201 gold badge3 silver badges7 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 7

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

In the template or HTML section use HTML ments

In the script, section use Javascript ments

// Comment /* Comment */

In style section use CSS ments

/* ment */

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

// <div> ment out this line</div>

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

<!-- <div> ment out this line</div>

     <div> ment out this line</div>

     <div> ment out this line</div> -->

or

/* <div> ment out this line</div>

   <div> ment out this line</div>

   <div> ment out this line</div> */

In order to change shortcut key

  • Windows: File > Preferences > Keyboard Shortcuts.

  • MacOS: Code > Preferences > Keyboard Shortcuts.

and then search for ment like this Screenshot

本文标签: javascriptHow to comment out a HTML tag in Vue 39s templateStack Overflow