Skip to content
Snippets Groups Projects
Commit ef3fc8de authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

reduce footprint and add notifications

parent a6b17d4d
No related branches found
No related tags found
1 merge request!14Draft: Data vue app
Pipeline #24213 passed
......@@ -79,15 +79,20 @@ final class VueApp implements Stringable
public function getTemplate(): Template
{
$data = [
'components' => [
$this->base_component,
...$this->components
],
];
if (count($this->stores) > 0) {
$data['stores'] = $this->stores;
}
$template = $GLOBALS['template_factory']->open('vue-app.php');
$template->attributes = [
'data-vue-app' => json_encode([
'components' => [
$this->base_component,
...$this->components
],
'stores' => $this->stores,
]),
'data-vue-app' => json_encode($data),
'is' => basename($this->base_component),
...$this->getPreparedProps(),
......@@ -108,7 +113,13 @@ final class VueApp implements Stringable
public function render(): string
{
return $this->getTemplate()->render();
\NotificationCenter::postNotification('VueAppWillRender', $this);
$content = $this->getTemplate()->render();
\NotificationCenter::postNotification('VueAppDidRender', $this);
return $content;
}
public function __toString(): string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment