Laravel livewire电线:模型不工作?

pn9klfpd  于 2022-11-18  发布在  其他
关注(0)|答案(1)|浏览(134)

数据正在从livewire组件发送到livewire刀片文件,但当我尝试应用wire:model时,它没有将 AJAX 请求从livewire刀片发送到livewire组件。
index.blade.php

<div class="card-header p-4 min-h-unset" id="kt_contacts_list_header">
    <!--begin::Form-->
    <p> Name: {{$name}}</p> <!--it is printing the name coming from the livewire component-->
    <form class="d-flex align-items-center position-relative w-100 m-0" autocomplete="off">
        <!--begin::Icon-->
        <!--begin::Svg Icon | path: icons/duotune/general/gen021.svg-->
        <span class="svg-icon svg-icon-3 svg-icon-gray-500 position-absolute top-50 ms-5 translate-middle-y">
                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
                        <rect opacity="0.5" x="17.0365" y="15.1223" width="8.15546" height="2" rx="1" transform="rotate(45 17.0365 15.1223)" fill="black" />
                        <path d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z" fill="black" />
                    </svg>
                </span>
        <!--end::Svg Icon-->
        <!--end::Icon-->
        <!--begin::Input-->
        <!--Livewire model-->
        <input wire:model="name" type="text" class="form-control form-control-solid ps-13" name="search" value="" placeholder="{{__('Search contacts')}}" />
        <!--end::Input-->
    </form>
    <!--end::Form-->
</div>

index.php

<?php

namespace App\Http\Livewire\Tenant\Modules\Contacts;

use Livewire\Component;

class Index extends Component
{
    public $group;
    public $name;

    public function mount()
    {
        $this->name = 'Zain';
    }
    
    public function render()
    {
        return view('livewire.tenant.modules.contacts.index');
    }
}

nwnhqdif

nwnhqdif1#

我得到了解决方案。当我从Livewire刀片中删除@section指令时,它开始工作了。

相关问题