I am putting steps functionality in my Todo list project.
I had created a composer for the livewire.
Also included @livewireStyles
and @livewireScripts
both in the header and the footer.
Here, my Increment control does not work
1) create.blade.php
<form method="post" action="{{route('todo.store')}}" class="py-5" >
@csrf
<div class="py-1">
<input type="text" name="title" class="px-2 py-2 border rounded" placeholder="Title">
</div>
......
@livewire('step')
<div>
<input type="text" name="stpe" class="px-2 py-2 border rounded" placeholder="Describe Steps">
</div>
</form>
2) step.blade.php
<div>
<div class="flex-justify-center pb-4 px-4">
<h2 class="text-lg pb-4">Add Stpes for task</h2>
<i wire:click="increment" class ="fas fa-plus px-2 py-1 cursor-pointer "></i>
</div>
{{$steps}}
</div>
3) step.php
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Step extends Component
{
public $steps = 0;
public function increment()
{
$this->steps++;
}
public function render()
{
return view('livewire.step');
}
}
After performing this code my '+' icon cannot perform the increment operation, please help me out.
Here your code looks ok, make sure you are using it on laravel server ie php artisan serve
command's platform: http://127.0.0.1:8000
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.