i created a new simple components for using into liveWire
and i'm trying to use this component from a single route, in below simple implementation increment
and decrement
not working for me
route:
Route::get('/login',LoginComponent::class);
LoginComponent::class
:
class LoginComponent extends Component
{
public $count = 10;
public function render()
{
return view('livewire.auth.login')->layout('livewire.auth.app');
}
public function increment()
{
$this->count++;
}
public function decrement()
{
$this->count--;
}
}
app.blade.php
:
<!DOCTYPE html>
<html lang="en">
<head>
...
@livewireStyles
</head>
<body>
<div class="page-content">
<div class="content-wrapper">
@yield('content')
</div>
</div>
@livewireScripts
</body>
</html>
and then login.blade.php
:
<div>
@section('content')
<div class="page-content">
<div class="content-wrapper">
<div class="content d-flex justify-content-center align-items-center">
<div style="text-align: center">
<button wire:click="increment"> + </button>
<button wire:click="decrement"> - </button>
<h1>{{ $count }}</h1>
</div>
</div>
</div>
</div>
@endsection
</div>
question from:
https://stackoverflow.com/questions/65641664/livewire-methods-not-working-on-simple-compnent 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…