From 9bda346dc789a2458d4de36b812aeea056a7470b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Pereira?= Date: Thu, 27 Jun 2024 18:05:07 -0300 Subject: [PATCH] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 2062befc..2d533e3d 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,22 @@ taxa_page: # - - - panel:specimen-records ``` +### Lifecycle hooks (Experimental feature) + +The `onCreatePage` and `onSSRPageCreate` functions allow you to execute code at the time the taxa page is created. `onSSRPageCreate` will be executed only on the server side in SSR mode. To make use of them it is necessary to include them in a file object called `pages/otus.config.js`. Both functions accept `otu`, `taxon`, `route` and `router` objects as parameters. Since `onCreatePage` runs on Taxa page component, it is possible to use hooks like `onMounted` or `onBeforeMount` inside it + +```javascript +export default { + onSSRCreatePage: async ({ otu, taxon, route, router }) => { + // Your code here + }, + + onCreatePage: ({ otu, taxon, route, router }) => { + // Your code here + } +} +``` + ### External panels To add panels in Taxa pages, create a folder called `panels` in your `setup` branch, and inside it create another folder for your panel. For example: `panels/PanelTest`