Before writing html in vscode, only you need to enter a !
, press Enter or tab you can generate some html code.
Vue in the learning process, the input template vue each time, as in FIG.
Vue paper to create templates, for example, shows a method to quickly add the code snippet.
-
shift + ctrl (command) + p, open the search bar, enter snippets (English meaning fragments), found Preferences: Configure User Snippets
-
Enter html, open html.json (if you need to add C ++ fragment, you can open cpp.json)
-
html.json
Sample code given segment. Rigorous sake, copy and paste this sample, and uncomment.
-
Modify information:
name of the first segment of the behavior of the code, just change all right, I definedmy vue html code
.
The second line is a custom prefix generate key codes, I defined aslog
the third line of body, add your code within the brackets.
"my vue html code": {
"prefix": "vue",
"body": [
],
"description": "Log output to console"
}
Note here that the code needs to be added each row with a double in quotation marks.
vscode select multiple lines of approach: windows alt + click with the mouse; mac with option + mouse click.
Selected after the multi-line double quotes may be added together to the line head and line end of each row.
Finally, remember that each row with a comma.
For html, also need to double the original quote quote all into a single
method is still the alt + mouse click, select Modify together after all need to change positions.
After completion, the direct input in the html code segment where needed the prefix keyword, can automatically generate a code segment.