Livewire: невозможно вызовать метод компонентов. Публичный метод [ChildmethodName] не найден на компоненте: [родитель]Php

Кемеровские программисты php общаются здесь
Anonymous
Livewire: невозможно вызовать метод компонентов. Публичный метод [ChildmethodName] не найден на компоненте: [родитель]

Сообщение Anonymous »

Используя Laravel Livewire, у меня есть родитель и (повторяющийся) ребенок. У детского лезвия есть призыв к ChildMethod () через Wire: click = "childmethod ()" .
Проблема в том, что родитель-> childmethod () вызывается, в то время как я хотел childmethod () .class StatementsTable extends Component // parent
{
public function render()
{
return view('livewire.statements-table', [
'statements' => Statement::limit(10)->get()
]);
}
}

родительские операторы table.blade

@foreach($statements as $statement)
@livewire('statement-line', ['statement' => $statement], key($statement->id))
@endforeach

< /code>
Дочерний компонент: < /p>
class StatementLine extends Component
{
public $statement;
public $calls = 0;

public function childMethod()
{
$this->calls += 1;
}

public function mount($statement): void
{
$this->statement = $statement;
}

public function render()
{
return view('livewire.statement-line');
}
}

witch-lene.blade
{{-- dd(get_defined_vars()) --}}

{{$statement->name}}
{{$statement->date}}
{{$calls}}
Plus

< /code>
Почему я получаю < /p>
Livewire\Exceptions\MethodNotFoundException
Unable to call component method. Public method [childMethod] not found on component: [statements-table]


Подробнее здесь: https://stackoverflow.com/questions/643 ... name-not-f

Вернуться в «Php»