From 6a25c7ed5b20dd754b88dc9eb6dc6cd9e2ba9612 Mon Sep 17 00:00:00 2001 From: mbardelmeijer Date: Thu, 6 Jul 2023 06:36:33 +0000 Subject: [PATCH] Fix styling --- src/LivewireNode.php | 7 +++---- src/LivewireTokenParser.php | 2 +- tests/NestedTest.php | 13 +++++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/LivewireNode.php b/src/LivewireNode.php index 98c2bd5..ca1d6e3 100644 --- a/src/LivewireNode.php +++ b/src/LivewireNode.php @@ -2,10 +2,10 @@ namespace Enflow\LivewireTwig; +use Livewire\LivewireBladeDirectives; use Twig\Compiler; use Twig\Node\Expression\AbstractExpression; use Twig\Node\Node; -use Livewire\LivewireBladeDirectives; class LivewireNode extends Node { @@ -24,7 +24,6 @@ public function compile(Compiler $compiler) ->write('$_vars = ')->subcompile($expr)->raw(";\n") ->write("?>\n") ->write(LivewireBladeDirectives::livewire("'$component', \$_vars")) - ->write("write("counter++; + $this->counter++; } + public function render() { return view('components.haschilds'); @@ -35,17 +37,20 @@ public function render() class Child extends Component { - static $renderedCount = 0; + public static $renderedCount = 0; + public $count = 1; public function incrementChild() { - $this->count++; + $this->count++; } + public function render() { static::$renderedCount++; $this->count = static::$renderedCount; + return view('components.counter'); } -} \ No newline at end of file +}