File tree Expand file tree Collapse file tree 1 file changed +4
-17
lines changed
adminforth/documentation/docs/tutorial/09-Advanced Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -507,22 +507,11 @@ To ensure that plugin activates before some other plugins set `activationOrder`
507507
508508## Splitting frontend logic into multiple files
509509
510- In case your plugin ` .vue ` files getting too big, you can split them into multiple files (components)
511- Unfortunately when developing plugin, you should register such components(files) manually by calling ` componentPath ` in ` modifyResourceConfig ` method:
510+ In case your plugin ` .vue ` files getting too big, you can split them into multiple files (components).
512511
512+ Just create a new file ` subComponent .vue ` in ` custom ` folder and add your code there.
513513
514- ` ` ` ts title= ' ./af-plugin-chatgpt/index.ts'
515- async modifyResourceConfig(adminforth : IAdminForth , resourceConfig : AdminForthResource ) {
516- super .modifyResourceConfig (adminforth , resourceConfig );
517- // diff-add
518- // we just call componentPath method to register component, not using it's result
519- // diff-add
520- this .componentPath (' subComponent.vue' ),
521- };
522- }
523- ```
524-
525- Now to import ` subComponent.vue ` in ` completionInput.vue ` file you should use ` @@/plugins/<plugin-class-name>/subComponent.vue ` path:
514+ Then import it as a component:
526515
527516` ` ` html title= ' ./af-plugin-chatgpt/custom/completionInput.vue'
528517<template >
@@ -534,12 +523,10 @@ Now to import `subComponent.vue` in `completionInput.vue` file you should use `@
534523
535524< script setup lang= " ts" >
536525// diff-add
537- import SubComponent from ' @@/plugins/ChatGptPlugin /subComponent.vue' ;
526+ import SubComponent from ' . /subComponent.vue' ;
538527< / script >
539528` ` `
540529
541- Pay attention that ` ChatGptPlugin ` is a class name of your plugin so it should be used in path.
542-
543530
544531## Using Adapters
545532
You can’t perform that action at this time.
0 commit comments