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 ...@@ -79,15 +79,20 @@ final class VueApp implements Stringable
public function getTemplate(): Template public function getTemplate(): Template
{ {
$template = $GLOBALS['template_factory']->open('vue-app.php'); $data = [
$template->attributes = [
'data-vue-app' => json_encode([
'components' => [ 'components' => [
$this->base_component, $this->base_component,
...$this->components ...$this->components
], ],
'stores' => $this->stores, ];
]),
if (count($this->stores) > 0) {
$data['stores'] = $this->stores;
}
$template = $GLOBALS['template_factory']->open('vue-app.php');
$template->attributes = [
'data-vue-app' => json_encode($data),
'is' => basename($this->base_component), 'is' => basename($this->base_component),
...$this->getPreparedProps(), ...$this->getPreparedProps(),
...@@ -108,7 +113,13 @@ final class VueApp implements Stringable ...@@ -108,7 +113,13 @@ final class VueApp implements Stringable
public function render(): string 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 public function __toString(): string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment