mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	添加vscode快速生成vue3.0代码片段文档
This commit is contained in:
		
							parent
							
								
									4b99092aef
								
							
						
					
					
						commit
						52f20896d9
					
				@ -1,28 +1,28 @@
 | 
				
			|||||||
import * as express from "express";
 | 
					import * as bodyParser from 'body-parser';
 | 
				
			||||||
import * as bodyParser from "body-parser";
 | 
					import * as express from 'express';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class App {
 | 
					class App {
 | 
				
			||||||
    public app: express.Application;
 | 
					    public app: express.Application;
 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        this.app = express();
 | 
					        this.app = express();
 | 
				
			||||||
        this.config();
 | 
					        this.config();
 | 
				
			||||||
    };
 | 
					    }
 | 
				
			||||||
    private config(): void {
 | 
					    private config(): void {
 | 
				
			||||||
        // 支持json编码的主体
 | 
					        // 支持json编码的主体
 | 
				
			||||||
        this.app.use(bodyParser.json());
 | 
					        this.app.use(bodyParser.json());
 | 
				
			||||||
        // 支持编码的主体
 | 
					        // 支持编码的主体
 | 
				
			||||||
        this.app.use(bodyParser.urlencoded({
 | 
					        this.app.use(bodyParser.urlencoded({
 | 
				
			||||||
            extended: true
 | 
					            extended: true,
 | 
				
			||||||
        }));
 | 
					        }));
 | 
				
			||||||
        // 设置静态访问目录(Swagger)
 | 
					        // 设置静态访问目录(Swagger)
 | 
				
			||||||
        this.app.use(express.static('public'));
 | 
					        this.app.use(express.static('public'));
 | 
				
			||||||
        // 设置跨域访问
 | 
					        // 设置跨域访问
 | 
				
			||||||
        this.app.all('*', (req, res, next) => {
 | 
					        this.app.all('*', (req, res, next) => {
 | 
				
			||||||
            res.header("Access-Control-Allow-Origin", "*");
 | 
					            res.header('Access-Control-Allow-Origin', '*');
 | 
				
			||||||
            res.header("Access-Control-Allow-Headers", "content-type");
 | 
					            res.header('Access-Control-Allow-Headers', 'content-type');
 | 
				
			||||||
            res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
 | 
					            res.header('Access-Control-Allow-Methods', 'PUT,POST,GET,DELETE,OPTIONS');
 | 
				
			||||||
            res.header("X-Powered-By", ' 3.2.1');
 | 
					            res.header('X-Powered-By', ' 3.2.1');
 | 
				
			||||||
            res.header("Content-Type", "application/json;charset=utf-8");
 | 
					            res.header('Content-Type', 'application/json;charset=utf-8');
 | 
				
			||||||
            next();
 | 
					            next();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,35 @@
 | 
				
			|||||||
## 1. hyper
 | 
					## 1. VsCode Plugs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					please install TSLint、Vetur、vscode-icons、ES7 React
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 2. Quick generation of code fragment by vscode
 | 
				
			||||||
 | 
					Ctrl+Shift+P Check configure user code fragment search vue.json Copy the code below Enter Vue in the .vue file and press enter
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						"Vue3.0Quick template generation": {
 | 
				
			||||||
 | 
							"prefix": "Vue3.0",
 | 
				
			||||||
 | 
							"body": [
 | 
				
			||||||
 | 
								"<template>",
 | 
				
			||||||
 | 
								"\t<div>\n",
 | 
				
			||||||
 | 
								"\t</div>",
 | 
				
			||||||
 | 
								"</template>\n",
 | 
				
			||||||
 | 
								"<script lang='ts'>",
 | 
				
			||||||
 | 
								"export default {",
 | 
				
			||||||
 | 
								"\tsetup(){",
 | 
				
			||||||
 | 
								"\t\treturn{\n\n\t\t}",
 | 
				
			||||||
 | 
								"\t},",
 | 
				
			||||||
 | 
								"}",
 | 
				
			||||||
 | 
								"</script>\n",
 | 
				
			||||||
 | 
								"<style scoped>\n",
 | 
				
			||||||
 | 
								"</style>",
 | 
				
			||||||
 | 
								"$2"
 | 
				
			||||||
 | 
							],
 | 
				
			||||||
 | 
							"description": "Vue3.0"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 3. hyper
 | 
				
			||||||
 | 
					
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								doc/docs/zh/plugs/images/snip.gif
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/docs/zh/plugs/images/snip.gif
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 252 KiB  | 
@ -1,4 +1,36 @@
 | 
				
			|||||||
## 1. hyper
 | 
					## 1. VsCode插件
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					请安装TSLint、Vetur、vscode-icons、ES7 React
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 2. VsCode快速生成代码片段
 | 
				
			||||||
 | 
					Ctrl+Shift+P 选中配置用户代码片段 搜索vue.json,将下面代码复制进去,在.vue文件输入vue回车即可
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						"Vue3.0快速生成模板": {
 | 
				
			||||||
 | 
							"prefix": "Vue3.0",
 | 
				
			||||||
 | 
							"body": [
 | 
				
			||||||
 | 
								"<template>",
 | 
				
			||||||
 | 
								"\t<div>\n",
 | 
				
			||||||
 | 
								"\t</div>",
 | 
				
			||||||
 | 
								"</template>\n",
 | 
				
			||||||
 | 
								"<script lang='ts'>",
 | 
				
			||||||
 | 
								"export default {",
 | 
				
			||||||
 | 
								"\tsetup(){",
 | 
				
			||||||
 | 
								"\t\treturn{\n\n\t\t}",
 | 
				
			||||||
 | 
								"\t},",
 | 
				
			||||||
 | 
								"}",
 | 
				
			||||||
 | 
								"</script>\n",
 | 
				
			||||||
 | 
								"<style scoped>\n",
 | 
				
			||||||
 | 
								"</style>",
 | 
				
			||||||
 | 
								"$2"
 | 
				
			||||||
 | 
							],
 | 
				
			||||||
 | 
							"description": "Vue3.0"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 3. hyper
 | 
				
			||||||
 | 
					
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user