File tree Expand file tree Collapse file tree 5 files changed +881
-60
lines changed
Expand file tree Collapse file tree 5 files changed +881
-60
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,13 @@ web/
286286- **职责**: 作为插件的唯一入口,实现 GVA 的插件接口,让框架能够识别和加载本插件。
287287
288288- **接口实现**: **必须**定义一个结构体并实现 `system.Plugin` 接口。
289+
290+ - **插件注册**: **必须**调用 ```
291+ func init() {
292+ interfaces.Register(Plugin)
293+ }
294+ ```
295+ 方法,让插件自动注册到本体中
289296
290297- ** ` Register ` 方法** : 实现 ` Register ` 方法,该方法接收一个 ` *gin.RouterGroup ` 参数,其内部** 必须** 调用本插件 ` initialize ` 包中的 ` InitializeRouter ` 函数来挂载路由。
291298
@@ -297,6 +304,11 @@ web/
297304- Initialize/Router引用Router层:通过 ` router.RouterGroupApp.XxxRouter.InitXxxRouter `
298305- 各模块通过enter.go文件组织和暴露功能,避免循环引用
299306
307+ ### 插件默认注册功能
308+
309+ ` plugin/register.go ` 文件下用 ` _ "github.com/flipped-aurora/gin-vue-admin/server/plugin/插件"
310+ ` 的方式匿名引用用于激活插件本体的init
311+
300312### 代码组织示例:
301313
3023141 . Service入口 (service/enter.go):
Original file line number Diff line number Diff line change @@ -286,6 +286,13 @@ web/
286286- **职责**: 作为插件的唯一入口,实现 GVA 的插件接口,让框架能够识别和加载本插件。
287287
288288- **接口实现**: **必须**定义一个结构体并实现 `system.Plugin` 接口。
289+
290+ - **插件注册**: **必须**调用 ```
291+ func init() {
292+ interfaces.Register(Plugin)
293+ }
294+ ```
295+ 方法,让插件自动注册到本体中
289296
290297- ** ` Register ` 方法** : 实现 ` Register ` 方法,该方法接收一个 ` *gin.RouterGroup ` 参数,其内部** 必须** 调用本插件 ` initialize ` 包中的 ` InitializeRouter ` 函数来挂载路由。
291298
@@ -297,6 +304,11 @@ web/
297304- Initialize/Router引用Router层:通过 ` router.RouterGroupApp.XxxRouter.InitXxxRouter `
298305- 各模块通过enter.go文件组织和暴露功能,避免循环引用
299306
307+ ### 插件默认注册功能
308+
309+ ` plugin/register.go ` 文件下用 ` _ "github.com/flipped-aurora/gin-vue-admin/server/plugin/插件"
310+ ` 的方式匿名引用用于激活插件本体的init
311+
300312### 代码组织示例:
301313
3023141 . Service入口 (service/enter.go):
You can’t perform that action at this time.
0 commit comments