This commit is contained in:
Jordan Diaz
2026-04-01 14:08:23 +00:00
parent 9810cab186
commit 95694c50b6
4 changed files with 49 additions and 1 deletions

View File

@@ -72,6 +72,10 @@ Patrón para colores configurables por el usuario:
JavaScript scopeado al módulo usando `section_id`:
This is the default and expected place for module JavaScript.
Do NOT embed `<script>` tags directly inside `index-base.tpl` for normal module behavior.
Keep `index-base.tpl` for HTML/Twig markup and put interactive logic in `script.js`.
```js
const section = document.getElementById('{{ section_id }}');
if (section) {
@@ -88,6 +92,15 @@ CmsApi.hook('/hooks/module_id/', { action: 'getData', id: 123 }, function(respon
});
```
If you are calling a hook that belongs to the current module, the endpoint must use the real module id:
```js
// Module folder: template/estandar/modulos/buscadorapartados_hjd8s/
CmsApi.hook('/hooks/buscadorapartados_hjd8s/', { termino: 'vela' }, function(response) {
console.log(response);
});
```
### Cuándo usar Vue 3
Usar Vue 3 CDN cuando la lógica requiera: