Radio Livewire Laravel - Cant get the radio value

velaa5lx  于 2023-06-24  发布在  其他
关注(0)|答案(1)|浏览(140)

这段代码来自我的资源/视图/收藏

<livewire:frontend.product.index :category="$category"/>

它与livewire绑定到livewire/frontend/product/index

<div class="card-header bg-white mt-3">
                <h4>Price</h4>
                <div class="card-body">
                    <label class="d-block" for="">
                        <input type="radio" name="priceSort" class="me-3" wire:model="priceInput"
                            value="high-to-low">High to Low

                            check : {{var_export(($priceInput))}}
                    </label>
                    <label class="d-block" for="">
                        <input type="radio" name="priceSort" class="me-3" wire:model="priceInput"
                            value="low-to-high">Low to High
                    </label>
                </div>
            </div>

我想从收音机中获取“从低到高”值,但似乎check : {{var_export(($priceInput))}}为空x1c 0d1x
这是我的livewire控制器代码

class Index extends Component
{
    public $category, $products;

    public $priceInput;

return view('livewire.frontend.product.index', [
            'products' => $this->products,
            'category' => $this->category,
        ]);
}

谢谢你的回答

yquaqz18

yquaqz181#

它解决了,我已经找到了,我需要输入

@livewireStyles

<head>
和/或

@livewireScripts

<body>

相关问题