我有一个非常简单的Livewire组件,其中包含一个文本字段和一个日期选择器:
<!-- test.blade.php -->
<div>
<input type="text" wire:model="test" placeholder="测试">
<input datepicker="" wire:model="start" datepicker-format="dd.mm.yyyy" type="text" placeholder="日期 ...">
</div>
/* Test.php */
class Test extends Component
{
public $test;
public $start;
public function mount()
{
$this->start = now()->format('d.m.Y');
}
public function render()
{
return view('livewire.test');
}
}
我使用的日期选择器是Flowbite Datepicker。
当我更改日期然后更改测试输入字段时,日期选择器会重置为今天的日期。
我需要做什么来保持start的值?
我已经尝试过什么? 我尝试在日期选择器上使用wire:ignore,但这没有帮助。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号