Mrcdh技术博客 Mrcdh技术博客
首页
  • Html5
  • Javascript
  • Nodejs
  • electron
  • Android
  • 微信公众号
  • 框架
  • 其他
  • Mysql
  • PHP
  • Python
  • java
  • Gulp
  • 其它
  • 网站
  • 资源
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Mrcdh

全栈开发小学生
首页
  • Html5
  • Javascript
  • Nodejs
  • electron
  • Android
  • 微信公众号
  • 框架
  • 其他
  • Mysql
  • PHP
  • Python
  • java
  • Gulp
  • 其它
  • 网站
  • 资源
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 常用插件

  • 常用技巧

    • vscode下的egg用户片段
  • 《Eggjs》
  • 常用技巧
mrcdh
2021-01-28

vscode下的egg用户片段

{
	// 控制器
	"egg.Controller": {
		"prefix": "eggco",
		"body": [
			"'use strict';",
			"const Controller = require('egg').Controller;",
			"/** @description $2 */",
			"class ${1:Demo}Controller extends Controller {",
			"  $0",
			"}",
			"module.exports = ${1:Demo}Controller;"
		],
		"description": "Egg Controlelr"
	},
	// 控制器方法
	"egg.Controller.method":{
		"prefix": "eggcom",
		"body": [
			"/** @description $2 */",
			"async $1() {",
			"  const { ctx } = this;",
			"  $0",
			"  ctx.body = '';",
			"}"
		],
		"description": "Egg Controlelr Method"
	},
	// 服务
	"egg.Service": {
		"prefix": "eggse",
		"body": [
			"'use strict';",
			"const Service = require('egg').Service;",
			"/** @description $2 */",
			"class ${1:Demo}Service extends Service {",
			"  $0",
			"}",
			"module.exports = ${1:Demo}Service;"
		],
		"description": "Egg Service"
	},
	// 服务方法
	"egg.Service.Method": {
		"prefix": "eggsem",
		"body": [
			"/** @description $2 */",
			"async $1() {",
			"  const { app } = this;",
			"  $0",
			"  return {};",
			"}"
		],
		"description": "Egg Service Method"
	},
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#egg#vscode
上次更新: 2023/09/22, 16:54:32
egg-validate-plus(参数校验基于async-validator)

← egg-validate-plus(参数校验基于async-validator)

最近更新
01
uniapp常见问题
03-19
02
Vue3项目搭建
12-25
03
使用pnpm的monorepo组织项目
11-01
更多文章>
Theme by Vdoing | Copyright © 2020-2025 Mrcdh | 苏ICP备2020058908号-1
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×