How to quickly generate code in Vscode

Table of contents

Quickly generate React code

Quickly generate vue code


While watching the video, I found that it is very convenient for the boss to use shortcut keys to quickly generate template codes, so I learned about it and now record the steps.

Quickly generate React code

First, find the "Configure User Code Snippet" button in vscode and click on it.

 Enter Javascript in the input box that appears.

 Select Javascript.json, a Javascript.json file will pop up

 Next, enter a template code in a js file and copy it to snippet generator: https://snippet-generator.app

 In the input box on the left, as shown below:

Copy the json file generated on the right directly into the Javascript.json file

Then, enter imR in the js file, click on the pop-up prompt box or press the tab key to quickly generate a piece of code.

 

Quickly generate vue code

Still click the "Configure User Code Snippet" button and enter vue.json

 If there is no vue.json, click

Create a new global code snippet file or create a new code snippet file in the "xxx" folder, then enter vue.json and press enter to generate a json file.

 

 

Then enter a piece of template code in the vue file, and then copy it to the input box on the left side of the snippet generator, as shown in the following figure:

 Then copy the json file generated on the right to the vue.json.code-snippets file.

 

After that, as long as we enter ted in the .vue file and click on the pop-up prompt box, we can generate a piece of template code

 

 

Guess you like

Origin blog.csdn.net/Celester_best/article/details/125629806